summaryrefslogtreecommitdiff
path: root/psycopg/psycopgmodule.c
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2017-02-03 04:28:27 +0000
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2017-02-03 04:29:27 +0000
commite1ef55ffbcec7a9a7f8d978c572050f59b1dff4e (patch)
treea1da4c2e21a93c91b5229004d3d6183816d9b7b7 /psycopg/psycopgmodule.c
parentc71559cf19adad51a029aebfd663401cdb130aa6 (diff)
downloadpsycopg2-async-keyword.tar.gz
Added async_ as an alias for asyncasync-keyword
Added in argument for psycopg2.connect() and connection.__init__, and for the connection.async attribute.
Diffstat (limited to 'psycopg/psycopgmodule.c')
-rw-r--r--psycopg/psycopgmodule.c10
1 files changed, 6 insertions, 4 deletions
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 */