Victor Stinner [Thu, 10 Jul 2014 23:04:16 +0000 (01:04 +0200)]
asyncio: sync with Tulip
- CoroWrapper.__del__() now reuses repr(CoroWrapper) to log the "... was never
yielded from" warning
- Improve CoroWrapper: copy also the qualified name on Python 3.4, not only on
Python 3.5+
Victor Stinner [Thu, 10 Jul 2014 22:21:27 +0000 (00:21 +0200)]
asyncio: sync with Tulip
- repr(Task) and repr(CoroWrapper) now also includes where these objects were
created. If the coroutine is not a generator (don't use "yield from"), use
the location of the function, not the location of the coro() wrapper.
- Fix create_task(): truncate the traceback to hide the call to create_task().
Victor Stinner [Thu, 10 Jul 2014 20:32:58 +0000 (22:32 +0200)]
asyncio: sync with Tulip
- Issues #21936, #21163: Fix sporadic failures of
test_future_exception_never_retrieved()
- Handle.cancel() now clears references to callback and args
- In debug mode, repr(Handle) now contains the location where the Handle was
created.
Victor Stinner [Tue, 8 Jul 2014 21:57:31 +0000 (23:57 +0200)]
asyncion, Tulip issue 181: BaseEventLoop.create_datagram_endpoint() now waits
until protocol.connection_made() has been called. Document also why transport
constructors use a waiter.
Victor Stinner [Tue, 8 Jul 2014 10:39:10 +0000 (12:39 +0200)]
Update asyncio documentation
- Document the new create_task() method
- "Hide" the Task class: point to the create_task() method for interoperability
- Rewrite the documentation of the Task class
- Document the "Pending task destroyed"
- Update output in debug mode of examples in the dev section
- Replace Task() with create_task() in examples
Victor Stinner [Tue, 8 Jul 2014 09:29:25 +0000 (11:29 +0200)]
asyncio: sync with Tulip
- Tulip issue 185: Add a create_task() method to event loops. The create_task()
method can be overriden in custom event loop to implement their own task
class. For example, greenio and Pulsar projects use their own task class. The
create_task() method is now preferred over creating directly task using the
Task class.
- tests: fix a warning
- fix typo in the name of a test function
- Update AbstractEventLoop: add new event loop methods; update also the unit test
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.