Victor Stinner [Mon, 7 Jul 2014 15:26:54 +0000 (17:26 +0200)]
asyncio: sync with Tulip
- Tulip issue #181: Faster create_connection(). Call directly
waiter.set_result() in the constructor of _ProactorBasePipeTransport and
_SelectorSocketTransport, instead of using of delaying the call with
call_soon().
- Cleanup iscoroutine()
Ned Deily [Sun, 6 Jul 2014 23:14:33 +0000 (16:14 -0700)]
Issue #21923: Prevent AttributeError in distutils.sysconfig.customize_compiler
due to possible uninitialized _config_vars. Original patch by Alex Gaynor.
Victor Stinner [Sat, 5 Jul 2014 13:38:59 +0000 (15:38 +0200)]
Closes #21921: Fix ResourceWarning in the asyncio examples: close the event
loop at exit. Patch written by Vajrasky Kok (I modified also the "hello world"
example using a coroutine).
Victor Stinner [Sat, 5 Jul 2014 13:29:41 +0000 (15:29 +0200)]
Closes #21886, #21447: Fix a race condition in asyncio when setting the result
of a Future with call_soon(). Add an helper, a private method, to set the
result only if the future was not cancelled.
Victor Stinner [Wed, 2 Jul 2014 22:59:00 +0000 (00:59 +0200)]
asyncio: sync with Tulip
* _UnixSubprocessTransport: fix file mode of stdin. Open stdin in write mode,
not in read mode
* Examples: close the event loop at exit
* More reliable CoroWrapper.__del__. If the constructor is interrupted by
KeyboardInterrupt or the coroutine objet is destroyed lately, some the
_source_traceback attribute doesn't exist anymore.
* repr(Task): include also the future the task is waiting for
Terry Jan Reedy [Tue, 1 Jul 2014 03:52:20 +0000 (23:52 -0400)]
Issue #18592: Refactor 2 SearchDialogBase.create_(option/other)_buttons methods
to remove duplication and return info for tests. Rewrite corresponding tests.
Test_create_option_buttons was not testing anything because of buggy
comparisons. Use Python subscripting to get widget options.
Victor Stinner [Mon, 30 Jun 2014 12:51:04 +0000 (14:51 +0200)]
Issue #21163: BaseEventLoop.run_until_complete() and test_utils.run_briefly()
don't log the "destroy pending task" message anymore. The log is redundant for
run_until_complete() and useless in run_briefly().
Victor Stinner [Mon, 30 Jun 2014 12:39:11 +0000 (14:39 +0200)]
asyncio: sync with Tulip
- Sort imports
- Simplify/optimize iscoroutine(). Inline inspect.isgenerator(obj): replace it
with isinstance(obj, types.GeneratorType)
- CoroWrapper: check at runtime if Python has the yield-from bug #21209. If
Python has the bug, check if CoroWrapper.send() was called by yield-from to
decide if parameters must be unpacked or not.
- Fix "Task was destroyed but it is pending!" warning in
test_task_source_traceback()
Victor Stinner [Fri, 27 Jun 2014 21:52:03 +0000 (23:52 +0200)]
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.
Victor Stinner [Fri, 27 Jun 2014 11:52:20 +0000 (13:52 +0200)]
asyncio, Tulip issue 137: In debug mode, save traceback where Future, Task and
Handle objects are created. Pass the traceback to call_exception_handler() in
the 'source_traceback' key.
The traceback is truncated to hide internal calls in asyncio, show only the
traceback from user code.
Add tests for the new source_traceback, and a test for the 'Future/Task
exception was never retrieved' log.
Victor Stinner [Wed, 25 Jun 2014 21:32:25 +0000 (23:32 +0200)]
asyncio: sync with Tulip
- Python issue 21163: Fix more "Task was destroyed but it is pending!" logs in
tests
- Add test to check that run_until_complete() checks the loop of the future
Senthil Kumaran [Wed, 25 Jun 2014 09:58:15 +0000 (02:58 -0700)]
issue20753 - robotparser tests should not rely upon external resource when not required.
Specifically, it was relying a URL which gave HTTP 403 and used it to assert
it's methods, this changes undoes that and provides a local http server with
similar properties.
Victor Stinner [Tue, 24 Jun 2014 20:57:14 +0000 (22:57 +0200)]
asyncio: repr(Task) now also contains the line number even if the coroutine is
done: use the first line number of the code object instead of the current line
number of the generator frame.
The name of the coroutine is not enough because many coroutines may have the
same name. It's a common case in asyncio tests for example.
Victor Stinner [Sun, 22 Jun 2014 23:02:37 +0000 (01:02 +0200)]
asyncio, Tulip issue 171: BaseEventLoop.close() now raises an exception if the
event loop is running. You must first stop the event loop and then wait until
it stopped, before closing it.
Victor Stinner [Sun, 22 Jun 2014 22:03:43 +0000 (00:03 +0200)]
asyncio: BaseEventLoop._assert_is_current_event_loop() now only raises an
exception if the current loop is not None.
Guido van Rossum wrote:
"The behavior that you can set the loop to None (and keep track of it
explicitly) is part of the spec, and this should still be supported even in
debug mode. The behavior that we raise an error if you are caught having
multiple active loops per thread is just a debugging heuristic, and it
shouldn't break code that follows the spec."