New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
python3.7 support #437
python3.7 support #437
Changes from all commits
d6f0b0f
528d889
13db903
97c3e45
a475a97
580f306
dc516b8
09ab8af
a734ad7
fb7cbfd
0a521d5
c5c01cb
8d82522
4528f49
e691586
c84ebca
b01c4c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,7 +106,7 @@ class Connection: | |
|
||
def __init__(self, dsn, loop, timeout, waiter, echo, **kwargs): | ||
self._loop = loop | ||
self._conn = psycopg2.connect(dsn, async=True, **kwargs) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here we can use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||
self._conn = psycopg2.connect(dsn, async_=True, **kwargs) | ||
self._dsn = self._conn.dsn | ||
assert self._conn.isexecuting(), "Is conn an async at all???" | ||
self._fileno = self._conn.fileno() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
try: | ||
ensure_future = asyncio.ensure_future | ||
except AttributeError: | ||
ensure_future = asyncio.async | ||
ensure_future = getattr(asyncio, 'async') | ||
|
||
|
||
def create_future(loop): | ||
|
@@ -86,7 +86,20 @@ class _SAConnectionContextManager(_ContextManager): | |
if PY_35: # pragma: no branch | ||
if PY_352: | ||
def __aiter__(self): | ||
return self._coro | ||
return self | ||
|
||
@asyncio.coroutine | ||
def __anext__(self): | ||
if self._obj is None: | ||
self._obj = yield from self._coro | ||
|
||
try: | ||
return (yield from self._obj.__anext__()) | ||
except StopAsyncIteration: | ||
self._obj.close() | ||
self._obj = None | ||
raise | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ideally, we would just make |
||
|
||
else: | ||
@asyncio.coroutine | ||
def __aiter__(self): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Want to replace "nightly" -> "3.7" but there is issue about Travis and python 3.7: travis-ci/travis-ci#9815
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can add a job with specific settings for that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind. I did this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@webknjaz nice. Did you mean to leave in the nightly build? Not opposed to it either way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nightly points to 3.8-dev now.