]> granicus.if.org Git - python/commitdiff
Merge 3.5 (issue #28613)
authorYury Selivanov <yury@magic.io>
Fri, 4 Nov 2016 18:30:11 +0000 (14:30 -0400)
committerYury Selivanov <yury@magic.io>
Fri, 4 Nov 2016 18:30:11 +0000 (14:30 -0400)
1  2 
Lib/asyncio/base_events.py
Lib/asyncio/test_utils.py
Lib/test/test_asyncio/test_futures.py
Lib/test/test_asyncio/test_tasks.py
Misc/NEWS

Simple merge
Simple merge
index 2c17ef2c27cdc53f895e32fc49de820997e16fab,153b8ed707f1b3b6c77579335c643195290d3ff4..fd4d2616f0870d758246edffe0e90f5e043f6df6
@@@ -94,12 -94,10 +95,13 @@@ class DuckTests(test_utils.TestCase)
          assert g is f
  
  
 -class FutureTests(test_utils.TestCase):
 +class BaseFutureTests:
 +
 +    def _new_future(self, loop=None):
 +        raise NotImplementedError
  
      def setUp(self):
+         super().setUp()
          self.loop = self.new_test_loop()
          self.addCleanup(self.loop.close)
  
          futures._set_result_unless_cancelled(fut, 2)
          self.assertTrue(fut.cancelled())
  
 +    def test_future_stop_iteration_args(self):
 +        fut = self._new_future(loop=self.loop)
 +        fut.set_result((1, 2))
 +        fi = fut.__iter__()
 +        result = None
 +        try:
 +            fi.send(None)
 +        except StopIteration as ex:
 +            result = ex.args[0]
 +        else:
 +            self.fail('StopIteration was expected')
 +        self.assertEqual(result, (1, 2))
 +
 +
 +@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)
 +
 +
 +class PyFutureTests(BaseFutureTests, test_utils.TestCase):
 +
 +    def _new_future(self, *args, **kwargs):
 +        return futures._PyFuture(*args, **kwargs)
  
 -class FutureDoneCallbackTests(test_utils.TestCase):
 +
 +class BaseFutureDoneCallbackTests():
  
      def setUp(self):
+         super().setUp()
          self.loop = self.new_test_loop()
  
      def run_briefly(self):
index d8862fccc798130d992714bcace9d1424550ea0f,22accf5d1edaa1d94a2901c86eb05af2024e33fe..ad8210b84aa5b057b2509783c74ac743c9767b44
@@@ -75,21 -72,11 +75,22 @@@ class Dummy
          pass
  
  
 -class TaskTests(test_utils.TestCase):
 +class BaseTaskTests:
 +
 +    Task = None
 +    Future = None
 +
 +    def new_task(self, loop, coro):
 +        return self.__class__.Task(coro, loop=loop)
 +
 +    def new_future(self, loop):
 +        return self.__class__.Future(loop=loop)
  
      def setUp(self):
+         super().setUp()
          self.loop = self.new_test_loop()
 +        self.loop.set_task_factory(self.new_task)
 +        self.loop.create_future = lambda: self.new_future(self.loop)
  
      def test_other_loop_future(self):
          other_loop = asyncio.new_event_loop()
diff --cc Misc/NEWS
index a6f48bef59e84254dfee7c9dac19fe2575b33a05,3e2b34f41c2855bdeeea780dc3b2105d887a6560..011df94766439233496f9a48f112a6d64e47c93d
+++ b/Misc/NEWS
@@@ -10,52 -10,105 +10,55 @@@ What's New in Python 3.6.0 beta 
  Core and Builtins
  -----------------
  
 -- 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().
 +- Issue #28583: PyDict_SetDefault didn't combine split table when needed.
    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)
 +Library
 +-------
  
 -- Issue #28189: dictitems_contains no longer swallows compare errors.
 -  (Patch by Xiang Zhang)
 +- 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 #27812: Properly clear out a generator's frame's backreference to the
 -  generator to prevent crashes in frame.clear().
 +- Issue #28600: Optimize loop.call_soon.
  
 -- Issue #27811: Fix a crash when a coroutine that has not been awaited is
 -  finalized with warnings-as-errors enabled.
++- Issue #28613: Fix get_event_loop() return the current loop if
++  called from coroutines/callbacks.
 -- Issue #27587: Fix another issue found by PVS-Studio: Null pointer check
 -  after use of 'def' in _PyState_AddModule().
 -  Initial patch by Christian Heimes.
 +Documentation
 +-------------
  
 -- Issue #26020: set literal evaluation order did not match documented behaviour.
 +- Issue #28513: Documented command-line interface of zipfile.
  
 -- 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.
 +What's New in Python 3.6.0 beta 3
 +=================================
  
 -- 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.
 +*Release date: 2016-10-31*
  
 -- 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.
 +Core and Builtins
 +-----------------
  
 -- 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 #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 #27083: Respect the PYTHONCASEOK environment variable under Windows.
 +- Issue #28509: dict.update() no longer allocate unnecessary large memory.
  
 -- Issue #27514: Make having too many statically nested blocks a SyntaxError
 -  instead of SystemError.
 +- Issue #28426: Fixed potential crash in PyUnicode_AsDecodedObject() in debug
 +  build.
  
 -- Issue #27473: Fixed possible integer overflow in bytes and bytearray
 -  concatenations.  Patch by Xiang Zhang.
 +- Issue #28517: Fixed of-by-one error in the peephole optimizer that caused
 +  keeping unreachable code.
  
 -- Issue #27507: Add integer overflow check in bytearray.extend().  Patch by
 -  Xiang Zhang.
 +- Issue #28214: Improved exception reporting for problematic __set_name__
 +  attributes.
  
 -- Issue #27581: Don't rely on wrapping for overflow check in
 -  PySequence_Tuple().  Patch by Xiang Zhang.
 +- Issue #23782: Fixed possible memory leak in _PyTraceback_Add() and exception
 +  loss in PyTraceBack_Here().
  
 -- Issue #27443: __length_hint__() of bytearray iterators no longer return a
 -  negative integer for a resized bytearray.
 +- Issue #28471: Fix "Python memory allocator called without holding the GIL"
 +  crash in socket.setblocking.
  
  Library
  -------