Victor Stinner
223a624158
Issue #21119 : asyncio now closes sockets on errors
...
Fix ResourceWarning: create_connection(), create_datagram_endpoint() and
create_unix_server() methods of event loop now close the newly created socket
on error.
2014-06-04 00:11:52 +02:00
Victor Stinner
8d21357fb5
Issue #21601 : Document asyncio.Task.cancel(). Initial patch written by Vajrasky
...
Kok.
2014-06-02 23:06:46 +02:00
Victor Stinner
a5b257af22
Issue #21454 : Fix asyncio.BaseEventLoop.connect_read_pipe doc
...
The function sets the the pipe to non-blocking mode.
2014-05-29 00:14:03 +02:00
Andrew Svetlov
3207a03035
Fix for raising exception not derived from BaseException in _SelectorSslTransport.resume_reading
2014-05-27 21:24:43 +03:00
Guido van Rossum
bf88ffba5e
asyncio: Fix upstream issue 168: StreamReader.read(-1) from pipe may hang if data exceeds buffer limit.
2014-05-12 10:04:37 -07:00
Guido van Rossum
3d1bc608a8
asyncio: Upstream issue #167 : remove dead code, by Marc Schlaich.
2014-05-10 15:47:15 -07:00
Guido van Rossum
3d139d8ed6
asyncio: Fix the second half of issue #21447 : race in _write_to_self().
2014-05-06 14:42:40 -07:00
Guido van Rossum
94ba146d11
asyncio: Add __weakref__ slots to Handle and CoroWrapper. Upstream issue #166 .
2014-04-27 10:44:22 -07:00
Guido van Rossum
83c1ddda46
asyncio: Be careful accessing instance variables in __del__ ( closes #21340 ).
2014-04-27 10:33:58 -07:00
Guido van Rossum
0cbc76880f
asyncio: Add gi_{frame,running,code} properties to CoroWrapper (upstream #163 ).
2014-04-15 12:06:34 -07:00
Yury Selivanov
09cc169a03
asyncio.tasks: Make sure CoroWrapper.send proxies one argument correctly
...
Issue #21209 .
2014-04-15 12:01:16 -04:00
Yury Selivanov
f15f7484bb
asyncio.tasks: Fix CoroWrapper to workaround yield-from bug in CPython < 3.4.1
...
Closes issue #21209 .
2014-04-14 22:21:52 -04:00
Victor Stinner
1fd03a4a22
Issue #21155 : asyncio.EventLoop.create_unix_server() now raises a ValueError if
...
path and sock are specified at the same time.
2014-04-07 11:18:54 +02:00
Victor Stinner
4bd652a276
asyncio: Document Task.cancel() properly.
2014-04-07 11:18:06 +02:00
Victor Stinner
93569c2b3d
asyncio: Ensure call_soon(), call_later() and call_at() are invoked on current
...
loop in debug mode. Raise a RuntimeError if the event loop of the current
thread is different. The check should help to debug thread-safetly issue.
Patch written by David Foster.
2014-03-21 10:00:52 +01:00
Victor Stinner
e6a537976e
asyncio, Tulip issue 157: Improve test_events.py, avoid run_briefly() which is
...
not reliable
2014-03-06 01:00:36 +01:00
Victor Stinner
eeeebcd816
asyncio: Synchronize with Tulip
...
* Issue #159 : Fix windows_utils.socketpair()
- Use "127.0.0.1" (IPv4) or "::1" (IPv6) host instead of "localhost", because
"localhost" may be a different IP address
- Reject also invalid arguments: only AF_INET/AF_INET6 with SOCK_STREAM (and
proto=0) are supported
* Reject add/remove reader/writer when event loop is closed.
* Fix ResourceWarning warnings
2014-03-06 00:52:53 +01:00
Victor Stinner
d74ac82df9
asyncio, Tulip issue 158: Task._step() now also sets self to None if an
...
exception is raised. self is set to None to break a reference cycle.
2014-03-04 23:07:08 +01:00
Victor Stinner
c89c8a7be9
asyncio/windows_events.py: use more revelant names to overlapped callbacks
...
For example: "finish_recv", not just "finish".
2014-02-26 17:35:30 +01:00
Victor Stinner
f5e37037cc
asyncio: Fix pyflakes warnings: remove unused variables and imports
2014-02-26 11:07:42 +01:00
Victor Stinner
24ba203504
asyncio: Replace "unittest.mock" with "mock" in unit tests
...
Use "from unittest import mock". It should simplify my work to merge new tests
in Trollius, because Trollius uses "mock" backport for Python 2.
2014-02-26 10:25:02 +01:00
Victor Stinner
a90e8edaea
asyncio: _check_resolved_address() must also accept IPv6 without flow_info and
...
scope_id: (host, port).
2014-02-20 21:59:38 +01:00
Victor Stinner
013dece44d
asyncio: Fix _check_resolved_address() for IPv6 address
2014-02-20 16:43:09 +01:00
Victor Stinner
da492a8c39
asyncio: remove unused imports and unused variables noticed by pyflakes
2014-02-20 10:37:27 +01:00
Victor Stinner
2c7203c6f5
asyncio: Fix _ProactorWritePipeTransport._pipe_closed()
...
The "exc" variable was not defined, pass a BrokenPipeError exception instead.
2014-02-20 10:33:01 +01:00
Victor Stinner
cdb476bd43
asyncio.subprocess: Fix a race condition in communicate()
...
Use self._loop instead of self._transport._loop, because transport._loop is set
to None at process exit.
2014-02-20 10:12:59 +01:00
Victor Stinner
7ef60cd8c2
asyncio, Tulip issue #136 : Add get/set_debug() methods to BaseEventLoopTests.
...
Add also a PYTHONASYNCIODEBUG environment variable to debug coroutines since
Python startup, to be able to debug coroutines defined directly in the asyncio
module.
2014-02-19 23:15:02 +01:00
Yury Selivanov
2d01c0a080
asyncio: WriteTransport.set_write_buffer_size to call _maybe_pause_protocol
2014-02-19 11:10:52 -05:00
Yury Selivanov
b41a42e316
asyncio: pep8-ify the code.
2014-02-18 22:56:15 -05:00
Yury Selivanov
b0b0e628ee
asyncio: Fix spelling and typos.
...
Thanks to Vajrasky Kok for discovering some of them.
2014-02-18 22:27:48 -05:00
Victor Stinner
884e40b982
asyncio, Tulip issue 143: UNIX domain methods, fix ResourceWarning and
...
DeprecationWarning warnings. create_unix_server() closes the socket on any
error, not only on OSError.
2014-02-19 01:45:59 +01:00
Victor Stinner
065ca25aae
asyncio, Tulip issue 139: Improve error messages on "fatal errors"
...
Mention if the error was caused by a read or a write, and be more specific on
the object (ex: "pipe transport" instead of "transport").
2014-02-19 01:40:41 +01:00
Yury Selivanov
c098241342
asyncio.transports: Make _ProactorBasePipeTransport use _FlowControlMixin
2014-02-18 18:41:13 -05:00
Yury Selivanov
ff827f08ac
asyncio: New error handling API. Issue #20681 .
2014-02-18 18:02:19 -05:00
Guido van Rossum
59a5533028
asyncio: Make tests pass on Windows.
2014-02-18 10:24:30 -08:00
Yury Selivanov
88a5bf0b2e
asyncio: Add support for UNIX Domain Sockets.
2014-02-18 12:15:06 -05:00
Victor Stinner
28773465e6
ayncio, Tulip issue 129: BaseEventLoop.sock_connect() now raises an error if
...
the address is not resolved (hostname instead of an IP address) for AF_INET and
AF_INET6 address families.
2014-02-13 09:24:37 +01:00
Guido van Rossum
b58f053e48
asyncio: Change as_completed() to use a Queue, to avoid O(N**2) behavior. Fixes issue #20566 .
2014-02-12 17:58:19 -08:00
Yury Selivanov
ee6dc425c8
asyncio.events: Use __slots__ in Handle and TimerHandle
2014-02-12 17:01:52 -05:00
Victor Stinner
2371e25517
Issue #20505 : Remove debug code
2014-02-11 17:53:47 +01:00
Victor Stinner
eb74876e99
asyncio, Tulip issue 131: as_completed() and wait() now raises a TypeError if
...
the list of futures is not a list but a Future, Task or coroutine object
2014-02-11 11:54:08 +01:00
Victor Stinner
4e8d2f25e2
asyncio, Tulip issue 130: Add more checks on subprocess_exec/subprocess_shell
...
parameters
2014-02-11 11:44:56 +01:00
Victor Stinner
a125497ea3
asyncio, Tulip issue 126: call_soon(), call_soon_threadsafe(), call_later(),
...
call_at() and run_in_executor() now raise a TypeError if the callback is a
coroutine function.
2014-02-11 11:34:30 +01:00
Victor Stinner
1db2ba3a92
Issue #20505 : use also the monotonic time to decide if asyncio debug traces
...
should be printed
2014-02-11 10:26:53 +01:00
Victor Stinner
5d1ea04b06
Issue #20505 : Oops, only print debug info if selector.select(timeout) took less
...
than timeout
2014-02-11 10:10:41 +01:00
Victor Stinner
7bff8e1e2b
Issue #20505 : Improve debug info in asyncio event loop
2014-02-11 10:08:08 +01:00
Victor Stinner
06847d9c8c
Issue #20505 : Fix TestLoop, set the clock resolution
2014-02-11 09:03:47 +01:00
Victor Stinner
6cf5c96630
Issue #20505 : BaseEventLoop uses again the resolution of the clock to decide if
...
scheduled tasks should be executed or not.
2014-02-10 23:42:32 +01:00
Victor Stinner
1c143b19c8
Issue #20505 : Add debug info to analyze sporaric failures of
...
test_timeout_rounding() on Windows XP buildbots.
2014-02-10 11:47:50 +01:00
Victor Stinner
dc62b7e261
asyncio: Tulip issue 112: Inline make_handle() into Handle constructor
2014-02-10 00:45:44 +01:00
Guido van Rossum
09f08fe248
asyncio: Remove more relics of resolution/granularity.
2014-02-08 19:44:02 -08:00
Victor Stinner
0c3949c963
asyncio: Remove Process.subprocess attribute; it's too easy to get inconsistent
...
Process and Popen objects
2014-02-09 02:51:40 +01:00
Victor Stinner
85310a50a9
Issue #20505 : Remove resolution and _granularity from selectors and asyncio
...
* Remove selectors.BaseSelector.resolution attribute
* Remove asyncio.BaseEventLoop._granularity attribute
2014-02-07 23:34:58 +01:00
Victor Stinner
3e7cc03f63
Issue #20505 : add debug info
2014-02-07 17:53:13 +01:00
Yury Selivanov
622be340fd
asyncio.tasks: Fix as_completed, gather & wait to work with duplicate coroutines
2014-02-06 22:06:16 -05:00
Yury Selivanov
f317cb7a20
asyncio.tasks.gather: Fix docstring
2014-02-06 12:03:53 -05:00
Yury Selivanov
f0020f5d77
asyncio.streams.StreamReader: Add 'at_eof()' method
2014-02-06 00:14:30 -05:00
Yury Selivanov
e694c9745f
asyncio.streams: Use bytebuffer in StreamReader; Add assertion in feed_data
2014-02-05 18:11:13 -05:00
Victor Stinner
83bdfa08f7
asyncio: Fix _ProactorWritePipeTransport._pipe_closed()
...
Do nothing if the pipe is already closed. _loop_writing() may call
_force_close() when it gets ConnectionResetError.
2014-02-04 08:57:48 +01:00
Victor Stinner
b79eb0502c
asyncio.subprocess: Replace Process.get_subprocess() method with a
...
Process.subprocess read-only property
2014-02-03 23:08:14 +01:00
Victor Stinner
915bcb0111
Issue #20400 : Merge Tulip into Python: add the new asyncio.subprocess module
...
* Add a new asyncio.subprocess module
* Add new create_subprocess_exec() and create_subprocess_shell() functions
* The new asyncio.subprocess.SubprocessStreamProtocol creates stream readers
for stdout and stderr and a stream writer for stdin.
* The new asyncio.subprocess.Process class offers an API close to the
subprocess.Popen class:
- pid, returncode, stdin, stdout and stderr attributes
- communicate(), wait(), send_signal(), terminate() and kill() methods
* Remove STDIN (0), STDOUT (1) and STDERR (2) constants from base_subprocess
and unix_events, to not be confused with the symbols with the same name of
subprocess and asyncio.subprocess modules
* _ProactorBasePipeTransport.get_write_buffer_size() now counts also the size
of the pending write
* _ProactorBaseWritePipeTransport._loop_writing() may now pause the protocol if
the write buffer size is greater than the high water mark (64 KB by default)
2014-02-01 22:49:59 +01:00
Victor Stinner
1506df2655
Issue #20455 : Add a resolution attribute to IocpProactor (1 ms)
2014-01-31 16:26:38 +01:00
Victor Stinner
f2e1768bc1
Issue #20455 : asyncio: use the same code to round a timeout than the selectors
...
module
Sort also imports
2014-01-31 16:25:24 +01:00
Victor Stinner
b60e9ca69d
Issue #20455 : asyncio: write a new write pipe transport class for proactor (on
...
Windows) instead of using the "duplex" pipe transport. The new class uses a
simpler overlapped read to be notified when the pipe is closed. So the protocol
doesn't need to implement eof_received(): connection_lost() is called instead.
_UnixWritePipeTransport has the same approach.
2014-01-31 14:18:18 +01:00
Victor Stinner
61b3c9bacc
asyncio: Fix _UnixWritePipeTransport, raise BrokenPipeError when the pipe is
...
closed, but only if there was pending write
2014-01-31 13:04:28 +01:00
Victor Stinner
49d0f4e428
Issue #20452 : Remove debug code, no more needed
2014-01-31 12:59:43 +01:00
Victor Stinner
323748e1d1
asyncio: Fix error message in BaseEventLoop.subprocess_shell(). Patch written
...
by Vajrasky Kok.
2014-01-31 12:28:30 +01:00
Victor Stinner
dcd9740ad2
Issue #20452 : select and selectors round (again) timeout away from zero for
...
poll and epoll
Improve also debug info to analyze the issue
2014-01-31 12:12:53 +01:00
Victor Stinner
31f65044a9
Issue #20452 : Oops, fix debug code :-/
...
Add also event more debug info
2014-01-31 10:55:55 +01:00
Victor Stinner
0278032110
Issue #20452 : add more info in case of test_asyncio failure to try to debug the
...
failure on buildbot "x86 Ubuntu Shared 3.x"
2014-01-31 09:29:35 +01:00
Guido van Rossum
a849be9c64
asyncio: Fix misc whitespace issues.
2014-01-30 16:05:28 -08:00
Victor Stinner
1c16537327
asyncio: Fix granularity of test_utils.TestLoop.
2014-01-30 16:05:07 -08:00
Victor Stinner
9572898282
asyncio: Future.set_exception(exc) should instantiate exc if it is a class.
2014-01-30 16:01:54 -08:00
Victor Stinner
e623a12297
asyncio: subprocess_shell() and subprocess_exec() now raise ValueError instead of assert.
...
Moreover, bufsize different than 0 is now considered as an error.
2014-01-29 14:35:15 -08:00
Victor Stinner
73f10fd2f1
asyncio: Fix _make_subprocess_transport(): pass extra value to the constructor.
2014-01-29 14:32:20 -08:00
Guido van Rossum
48c66c3dd8
asyncio: wait_for() now accepts None as timeout (Victor Stinner).
2014-01-29 14:30:38 -08:00
Guido van Rossum
1e9a446ebe
asyncio: Pass through pause/resume from subprocess pipe proto to subprocess proto. Also kill dummy eof_received().
2014-01-29 14:28:15 -08:00
Guido van Rossum
4d62d0b353
asyncio: Refactor drain logic in streams.py to be reusable.
2014-01-29 14:24:45 -08:00
Victor Stinner
aaabc4fdca
asyncio: Get rid of _try_connected().
2014-01-29 14:22:56 -08:00
Guido van Rossum
47fb97e4e6
asyncio: Add write flow control to unix pipes.
2014-01-29 13:20:39 -08:00
Guido van Rossum
3ccead1f6a
asyncio: Refactoring: move write flow control to a subclass/mixin.
2014-01-29 13:15:59 -08:00
Victor Stinner
63b4d4b494
asyncio: _fatal_error() of _UnixWritePipeTransport and _ProactorBasePipeTransport shouldn't log BrokenPipeError nor ConnectionResetError.
...
(Same behaviour as _SelectorTransport._fatal_error().)
2014-01-29 13:12:03 -08:00
Victor Stinner
7aedea40d6
asyncio: remove temporary aliases
2014-01-28 00:09:24 +01:00
Andrew Svetlov
0742cae335
Merge latest Tulip into asyncio
2014-01-26 18:36:01 +02:00
Guido van Rossum
fef7098ef9
asyncio: Rename {Empty,Full} to {QueueEmpty,QueueFull} and no longer get them from queue.py.
2014-01-25 17:24:51 -08:00
Guido van Rossum
ab3c88983b
asyncio: Locks refactor: use a separate context manager; remove Semaphore._locked.
2014-01-25 16:51:57 -08:00
Guido van Rossum
ab27a9fc4b
asyncio: Fix race in FastChildWatcher (by its original author, Anthony Baire).
2014-01-25 16:32:17 -08:00
Victor Stinner
669eeaf933
Merge latest Tulip into asyncio
...
- Make the new granularity attribute private
- Simplify BaseEventLoop._run_once(): avoid math.ceil(), use simple arithmetic
instead
2014-01-26 00:02:31 +01:00
Victor Stinner
128ee220e2
asyncio: Don't export BaseEventLoop, BaseSelectorEventLoop nor
...
BaseProactorEventLoop
Import them from submodules if you really need them.
2014-01-25 22:22:18 +01:00
Victor Stinner
8dffc456d7
Update asyncio from the Tulip project
...
Major changes:
- StreamReader.readexactly() now raises an IncompleteReadError if the
end of stream is reached before we received enough bytes, instead of
returning less bytes than requested.
- Unit tests use the main asyncio module instead of submodules like events
- _UnixWritePipeTransport now also supports character devices, as
_UnixReadPipeTransport. Patch written by Jonathan Slenders.
- Export more symbols: BaseEventLoop, BaseProactorEventLoop,
BaseSelectorEventLoop, Queue and Queue sublasses, Empty, Full
2014-01-25 15:32:06 +01:00
Victor Stinner
75a5ec88ff
Fix asyncio tests: define resolution
2014-01-25 15:31:06 +01:00
Victor Stinner
f67255ab94
Issue #20311 : asyncio: Add a granularity attribute to BaseEventLoop: maximum
...
between the resolution of the BaseEventLoop.time() method and the resolution of
the selector. The granuarility is used in the scheduler to round time and
deadline.
2014-01-25 15:01:33 +01:00
Victor Stinner
421e49b5c1
asyncio: wait_for() now cancels the future on timeout. Patch written by Gustavo
...
Carneiro.
2014-01-23 17:40:59 +01:00
Victor Stinner
183e347796
asyncio (Tulip issue 110): StreamReader.read() and StreamReader.readline() now
...
raise a RuntimeError, instead of using an assertion, if another coroutine is
already waiting for incoming data
2014-01-23 17:40:03 +01:00
Victor Stinner
3eb45d3eae
asyncio: Fix open_connection() documentation, writer is a StreamWriter
2014-01-23 10:20:18 +01:00
Victor Stinner
4a2dbeb0d3
asyncio: Cleanup logging in BaseEventLoop._run_once()
...
logger.log() is now responsible to format the timeout. It might be faster if
the log is disabled for DEBUG level, but it's also more readable and fix
an issue with Python 2.6 in the Trollius project.
2014-01-22 12:26:01 +01:00
Victor Stinner
22463aa947
Close #20275 : Optimize BaseEventLoop._run_once()
...
Logger.log() is "slow", logger.isEnabledFor() is faster and the logger is
disabled in most cases. A microbenchmark executing 100,000 dummy tasks is 22%
faster with this change.
2014-01-20 23:56:40 +01:00
Guido van Rossum
e1f554490d
asyncio: Reincarnate CoroWrapper's docstring as a comment.
2014-01-16 11:05:23 -08:00
Victor Stinner
bac7793b5b
asyncio: Fix CoroWrapper (fix my previous commit)
...
Add __name__ and __doc__ to __slots__
2014-01-16 01:55:29 +01:00
Victor Stinner
4d7a29c5de
asyncio: Fix a typo in CoroWrapper
...
__slot__ => __slots__
2014-01-16 01:38:24 +01:00