[Python-modules-commits] [aiopg] 01/03: Import aiopg_0.11.0.orig.tar.gz
Piotr Ożarowski
piotr at moszumanska.debian.org
Wed Sep 21 19:44:17 UTC 2016
This is an automated email from the git hooks/post-receive script.
piotr pushed a commit to branch master
in repository aiopg.
commit 3c2375afafe1ac93d7c996caf1f24bffdda8d296
Author: Piotr Ożarowski <piotr at debian.org>
Date: Wed Sep 21 21:38:46 2016 +0200
Import aiopg_0.11.0.orig.tar.gz
---
CHANGES.txt | 7 +++++++
PKG-INFO | 11 +++++++++--
aiopg.egg-info/PKG-INFO | 11 +++++++++--
aiopg.egg-info/SOURCES.txt | 1 +
aiopg/__init__.py | 2 +-
aiopg/connection.py | 25 ++++++++++++++++++++-----
aiopg/cursor.py | 6 ++++--
aiopg/sa/result.py | 7 +++++--
aiopg/utils.py | 14 ++++++++++----
setup.cfg | 2 ++
setup.py | 10 +++-------
11 files changed, 71 insertions(+), 25 deletions(-)
diff --git a/CHANGES.txt b/CHANGES.txt
index c8da093..b0e0b99 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,6 +1,13 @@
CHANGES
-------
+0.11.0 (2016-09-12)
+^^^^^^^^^^^^^^^^^^^
+
+* Immediately remove callbacks from a closed file descriptor #139
+
+* Drop Python 3.3 support
+
0.10.0 (2016-07-16)
^^^^^^^^^^^^^^^^^^^
diff --git a/PKG-INFO b/PKG-INFO
index 7c28766..a3ed5fb 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: aiopg
-Version: 0.10.0
+Version: 0.11.0
Summary: Postgres integration with asyncio.
Home-page: https://aiopg.readthedocs.io
Author: Andrew Svetlov
@@ -95,6 +95,13 @@ Description: aiopg
CHANGES
-------
+ 0.11.0 (2016-09-12)
+ ^^^^^^^^^^^^^^^^^^^
+
+ * Immediately remove callbacks from a closed file descriptor #139
+
+ * Drop Python 3.3 support
+
0.10.0 (2016-07-16)
^^^^^^^^^^^^^^^^^^^
@@ -257,8 +264,8 @@ Platform: POSIX
Classifier: License :: OSI Approved :: BSD License
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
Classifier: Operating System :: POSIX
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Environment :: Web Environment
diff --git a/aiopg.egg-info/PKG-INFO b/aiopg.egg-info/PKG-INFO
index 7c28766..a3ed5fb 100644
--- a/aiopg.egg-info/PKG-INFO
+++ b/aiopg.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: aiopg
-Version: 0.10.0
+Version: 0.11.0
Summary: Postgres integration with asyncio.
Home-page: https://aiopg.readthedocs.io
Author: Andrew Svetlov
@@ -95,6 +95,13 @@ Description: aiopg
CHANGES
-------
+ 0.11.0 (2016-09-12)
+ ^^^^^^^^^^^^^^^^^^^
+
+ * Immediately remove callbacks from a closed file descriptor #139
+
+ * Drop Python 3.3 support
+
0.10.0 (2016-07-16)
^^^^^^^^^^^^^^^^^^^
@@ -257,8 +264,8 @@ Platform: POSIX
Classifier: License :: OSI Approved :: BSD License
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
Classifier: Operating System :: POSIX
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Environment :: Web Environment
diff --git a/aiopg.egg-info/SOURCES.txt b/aiopg.egg-info/SOURCES.txt
index e5b66bc..65e87eb 100644
--- a/aiopg.egg-info/SOURCES.txt
+++ b/aiopg.egg-info/SOURCES.txt
@@ -2,6 +2,7 @@ CHANGES.txt
LICENSE.txt
MANIFEST.in
README.rst
+setup.cfg
setup.py
aiopg/__init__.py
aiopg/connection.py
diff --git a/aiopg/__init__.py b/aiopg/__init__.py
index 1892d93..8281199 100644
--- a/aiopg/__init__.py
+++ b/aiopg/__init__.py
@@ -10,7 +10,7 @@ from .pool import create_pool, Pool
__all__ = ('connect', 'create_pool', 'Connection', 'Cursor', 'Pool',
'version', 'version_info', 'DEFAULT_TIMEOUT')
-__version__ = '0.10.0'
+__version__ = '0.11.0'
version = __version__ + ' , Python ' + sys.version
diff --git a/aiopg/connection.py b/aiopg/connection.py
index a34874a..26531f5 100644
--- a/aiopg/connection.py
+++ b/aiopg/connection.py
@@ -1,5 +1,7 @@
import asyncio
+import contextlib
import errno
+import fcntl
import sys
import traceback
import warnings
@@ -120,10 +122,22 @@ class Connection:
notify = self._conn.notifies.pop(0)
self._notifies.put_nowait(notify)
except (psycopg2.Warning, psycopg2.Error) as exc:
+ if self._fileno is not None:
+ try:
+ fcntl.fcntl(self._fileno, fcntl.F_GETFD)
+ except OSError as os_exc:
+ if os_exc.errno == errno.EBADF:
+ with contextlib.suppress(OSError):
+ self._loop.remove_reader(self._fileno)
+ finally:
+ # forget a bad file descriptor, don't try to touch it
+ self._fileno = None
+
try:
if self._writing:
self._writing = False
- self._loop.remove_writer(self._fileno)
+ if self._fileno is not None:
+ self._loop.remove_writer(self._fileno)
except OSError as exc2:
if exc2.errno != errno.EBADF:
# EBADF is ok for closed file descriptor
@@ -244,10 +258,11 @@ class Connection:
"""Remove the connection from the event_loop and close it."""
# N.B. If connection contains uncommitted transaction the
# transaction will be discarded
- self._loop.remove_reader(self._fileno)
- if self._writing:
- self._writing = False
- self._loop.remove_writer(self._fileno)
+ if self._fileno is not None:
+ self._loop.remove_reader(self._fileno)
+ if self._writing:
+ self._writing = False
+ self._loop.remove_writer(self._fileno)
self._conn.close()
if self._waiter is not None and not self._waiter.done():
self._waiter.set_exception(
diff --git a/aiopg/cursor.py b/aiopg/cursor.py
index f63ee4a..f3db330 100644
--- a/aiopg/cursor.py
+++ b/aiopg/cursor.py
@@ -4,7 +4,7 @@ import warnings
import psycopg2
from .log import logger
-from .utils import PY_35
+from .utils import PY_35, PY_352
class Cursor:
@@ -379,10 +379,12 @@ class Cursor:
if PY_35: # pragma: no branch
- @asyncio.coroutine
def __aiter__(self):
return self
+ if not PY_352:
+ __aiter__ = asyncio.coroutine(__aiter__)
+
@asyncio.coroutine
def __anext__(self):
ret = yield from self.fetchone()
diff --git a/aiopg/sa/result.py b/aiopg/sa/result.py
index 2c3c924..6452814 100644
--- a/aiopg/sa/result.py
+++ b/aiopg/sa/result.py
@@ -5,7 +5,7 @@ from collections.abc import Mapping, Sequence
from sqlalchemy.sql import expression, sqltypes
-from ..utils import PY_35
+from ..utils import PY_35, PY_352
from . import exc
@@ -324,10 +324,13 @@ class ResultProxy:
yield row
if PY_35: # pragma: no branch
- @asyncio.coroutine
+
def __aiter__(self):
return self
+ if not PY_352:
+ __aiter__ = asyncio.coroutine(__aiter__)
+
@asyncio.coroutine
def __anext__(self):
ret = yield from self.fetchone()
diff --git a/aiopg/utils.py b/aiopg/utils.py
index c22120c..84a768d 100644
--- a/aiopg/utils.py
+++ b/aiopg/utils.py
@@ -3,6 +3,8 @@ import sys
PY_35 = sys.version_info >= (3, 5)
+PY_352 = sys.version_info >= (3, 5, 2)
+
if PY_35:
from collections.abc import Coroutine
base = Coroutine
@@ -84,10 +86,14 @@ class _ContextManager(base):
class _SAConnectionContextManager(_ContextManager):
if PY_35: # pragma: no branch
- @asyncio.coroutine
- def __aiter__(self):
- result = yield from self._coro
- return result
+ if PY_352:
+ def __aiter__(self):
+ return self._coro
+ else:
+ @asyncio.coroutine
+ def __aiter__(self):
+ result = yield from self._coro
+ return result
class _PoolContextManager(_ContextManager):
diff --git a/setup.cfg b/setup.cfg
index 861a9f5..21307fd 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,3 +1,5 @@
+[tool:pytest]
+
[egg_info]
tag_build =
tag_date = 0
diff --git a/setup.py b/setup.py
index 041ddf5..9b937b3 100644
--- a/setup.py
+++ b/setup.py
@@ -8,12 +8,8 @@ install_requires = ['psycopg2>=2.5.2']
PY_VER = sys.version_info
-if PY_VER >= (3, 4):
- pass
-elif PY_VER >= (3, 3):
- install_requires.append('asyncio')
-else:
- raise RuntimeError("aiopg doesn't suppport Python earlier than 3.3")
+if PY_VER < (3, 4):
+ raise RuntimeError("aiopg doesn't suppport Python earlier than 3.4")
def read(f):
@@ -37,8 +33,8 @@ classifiers = [
'License :: OSI Approved :: BSD License',
'Intended Audience :: Developers',
'Programming Language :: Python :: 3',
- 'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
+ 'Programming Language :: Python :: 3.5',
'Operating System :: POSIX',
'Operating System :: MacOS :: MacOS X',
'Environment :: Web Environment',
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/aiopg.git
More information about the Python-modules-commits
mailing list