Skip to content

Commit

Permalink
Merge pull request #21 from aio-libs/fix-async-iteration-protocol
Browse files Browse the repository at this point in the history
Fix async iteration protocol
  • Loading branch information
jettify committed Aug 25, 2016
2 parents 0fff9ca + 93cba3f commit dda5c16
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
9 changes: 7 additions & 2 deletions aioodbc/cursor.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pyodbc
from .log import logger
from .utils import PY_352


__all__ = ['Cursor']
Expand Down Expand Up @@ -297,8 +298,12 @@ def rollback(self):
fut = self._run_operation(self._impl.rollback)
return fut

async def __aiter__(self):
return self
if PY_352:
async def __aiter__(self):
return self
else:
def __aiter__(self):
return self

async def __anext__(self):
ret = await self.fetchone()
Expand Down
4 changes: 4 additions & 0 deletions aioodbc/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import sys
from collections.abc import Coroutine


PY_352 = sys.version_info >= (3, 5, 2)


class _ContextManager(Coroutine):

__slots__ = ('_coro', '_obj')
Expand Down
4 changes: 2 additions & 2 deletions ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM python:3.5.1-slim
FROM python:3.5.2-slim
RUN apt-get update && apt-get install -y \
unixODBC wget g++ unixodbc-dev odbc-postgresql libmyodbc libsqlite-dev libtool build-essential && \
odbcinst -i -d -f /usr/share/libmyodbc/odbcinst.ini && \
wget http://http.us.debian.org/debian/pool/main/s/sqliteodbc/libsqliteodbc_0.9992-0.1_amd64.deb && \
wget http://archive.ubuntu.com/ubuntu/pool/universe/s/sqliteodbc/libsqliteodbc_0.9992-0.1_amd64.deb && \
dpkg -i libsqliteodbc_0.9992-0.1_amd64.deb

ADD / /aioodbc
Expand Down

0 comments on commit dda5c16

Please sign in to comment.