summaryrefslogtreecommitdiff
path: root/psycopg
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2017-02-03 04:56:02 +0000
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2017-02-03 04:56:02 +0000
commitde8b335d80ecba0305e2b4796373a4064fd450b3 (patch)
tree26a5fab1a9f022adda5d5ad2de78b816fe0350e1 /psycopg
parenta8a3a298f8ade3b0430ff2df0a5d5ee1fe920e3d (diff)
parentca42306d7916647448184907e03c77ff54ebd4f9 (diff)
downloadpsycopg2-sql-compose.tar.gz
Merge branch 'master' into sql-composesql-compose
Diffstat (limited to 'psycopg')
-rw-r--r--psycopg/connection_type.c10
-rw-r--r--psycopg/psycopgmodule.c10
2 files changed, 13 insertions, 7 deletions
diff --git a/psycopg/connection_type.c b/psycopg/connection_type.c
index 7401bc1..2066579 100644
--- a/psycopg/connection_type.c
+++ b/psycopg/connection_type.c
@@ -1040,6 +1040,8 @@ static struct PyMemberDef connectionObject_members[] = {
"The current connection string."},
{"async", T_LONG, offsetof(connectionObject, async), READONLY,
"True if the connection is asynchronous."},
+ {"async_", T_LONG, offsetof(connectionObject, async), READONLY,
+ "True if the connection is asynchronous."},
{"status", T_INT,
offsetof(connectionObject, status), READONLY,
"The current transaction status."},
@@ -1186,12 +1188,14 @@ static int
connection_init(PyObject *obj, PyObject *args, PyObject *kwds)
{
const char *dsn;
- long int async = 0;
- static char *kwlist[] = {"dsn", "async", NULL};
+ long int async = 0, async_ = 0;
+ static char *kwlist[] = {"dsn", "async", "async_", NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|l", kwlist, &dsn, &async))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|ll", kwlist,
+ &dsn, &async, &async_))
return -1;
+ if (async_) { async = async_; }
return connection_setup((connectionObject *)obj, dsn, async);
}
diff --git a/psycopg/psycopgmodule.c b/psycopg/psycopgmodule.c
index c4d1517..6c95bd6 100644
--- a/psycopg/psycopgmodule.c
+++ b/psycopg/psycopgmodule.c
@@ -82,15 +82,17 @@ psyco_connect(PyObject *self, PyObject *args, PyObject *keywds)
PyObject *conn = NULL;
PyObject *factory = NULL;
const char *dsn = NULL;
- int async = 0;
+ int async = 0, async_ = 0;
- static char *kwlist[] = {"dsn", "connection_factory", "async", NULL};
+ static char *kwlist[] = {"dsn", "connection_factory", "async", "async_", NULL};
- if (!PyArg_ParseTupleAndKeywords(args, keywds, "s|Oi", kwlist,
- &dsn, &factory, &async)) {
+ if (!PyArg_ParseTupleAndKeywords(args, keywds, "s|Oii", kwlist,
+ &dsn, &factory, &async, &async_)) {
return NULL;
}
+ if (async_) { async = async_; }
+
Dprintf("psyco_connect: dsn = '%s', async = %d", dsn, async);
/* allocate connection, fill with errors and return it */