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
diff --git a/Lib/asyncio/__init__.py b/Lib/asyncio/__init__.py
index 0d288d5..95235dc 100644
--- a/Lib/asyncio/__init__.py
+++ b/Lib/asyncio/__init__.py
@@ -18,13 +18,17 @@
         import _overlapped  # Will also be exported.
 
 # This relies on each of the submodules having an __all__ variable.
-from .futures import *
+from .base_events import *
 from .events import *
+from .futures import *
 from .locks import *
-from .transports import *
+from .proactor_events import *
 from .protocols import *
+from .queues import *
+from .selector_events import *
 from .streams import *
 from .tasks import *
+from .transports import *
 
 if sys.platform == 'win32':  # pragma: no cover
     from .windows_events import *
@@ -32,10 +36,14 @@
     from .unix_events import *  # pragma: no cover
 
 
-__all__ = (futures.__all__ +
+__all__ = (base_events.__all__ +
            events.__all__ +
+           futures.__all__ +
            locks.__all__ +
-           transports.__all__ +
+           proactor_events.__all__ +
            protocols.__all__ +
+           queues.__all__ +
+           selector_events.__all__ +
            streams.__all__ +
-           tasks.__all__)
+           tasks.__all__ +
+           transports.__all__)
diff --git a/Lib/asyncio/proactor_events.py b/Lib/asyncio/proactor_events.py
index ba5169e..3b44f24 100644
--- a/Lib/asyncio/proactor_events.py
+++ b/Lib/asyncio/proactor_events.py
@@ -4,6 +4,8 @@
 proactor is only implemented on Windows with IOCP.
 """
 
+__all__ = ['BaseProactorEventLoop']
+
 import socket
 
 from . import base_events
diff --git a/Lib/asyncio/selector_events.py b/Lib/asyncio/selector_events.py
index d2b3ccc..900eec0 100644
--- a/Lib/asyncio/selector_events.py
+++ b/Lib/asyncio/selector_events.py
@@ -4,6 +4,8 @@
 also includes support for signal handling, see the unix_events sub-module.
 """
 
+__all__ = ['BaseSelectorEventLoop']
+
 import collections
 import errno
 import socket
diff --git a/Lib/asyncio/streams.py b/Lib/asyncio/streams.py
index b53080e..10d3591 100644
--- a/Lib/asyncio/streams.py
+++ b/Lib/asyncio/streams.py
@@ -1,7 +1,7 @@
 """Stream-related things."""
 
 __all__ = ['StreamReader', 'StreamWriter', 'StreamReaderProtocol',
-           'open_connection', 'start_server',
+           'open_connection', 'start_server', 'IncompleteReadError',
            ]
 
 import collections
@@ -14,6 +14,19 @@
 
 _DEFAULT_LIMIT = 2**16
 
+class IncompleteReadError(EOFError):
+    """
+    Incomplete read error. Attributes:
+
+    - partial: read bytes string before the end of stream was reached
+    - expected: total number of expected bytes
+    """
+    def __init__(self, partial, expected):
+        EOFError.__init__(self, "%s bytes read on a total of %s expected bytes"
+                                % (len(partial), expected))
+        self.partial = partial
+        self.expected = expected
+
 
 @tasks.coroutine
 def open_connection(host=None, port=None, *,
@@ -403,12 +416,9 @@
         while n > 0:
             block = yield from self.read(n)
             if not block:
-                break
+                partial = b''.join(blocks)
+                raise IncompleteReadError(partial, len(partial) + n)
             blocks.append(block)
             n -= len(block)
 
-        # TODO: Raise EOFError if we break before n == 0?  (That would
-        # be a change in specification, but I've always had to add an
-        # explicit size check to the caller.)
-
         return b''.join(blocks)
diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py
index 24da327..7a6546d 100644
--- a/Lib/asyncio/unix_events.py
+++ b/Lib/asyncio/unix_events.py
@@ -259,9 +259,11 @@
         self._fileno = pipe.fileno()
         mode = os.fstat(self._fileno).st_mode
         is_socket = stat.S_ISSOCK(mode)
-        is_pipe = stat.S_ISFIFO(mode)
-        if not (is_socket or is_pipe):
-            raise ValueError("Pipe transport is for pipes/sockets only.")
+        if not (is_socket or
+                stat.S_ISFIFO(mode) or
+                stat.S_ISCHR(mode)):
+            raise ValueError("Pipe transport is only for "
+                             "pipes, sockets and character devices")
         _set_nonblocking(self._fileno)
         self._protocol = protocol
         self._buffer = []