From 101b054c32a54acd5d1c84b03ebc71cac51b3e3b Mon Sep 17 00:00:00 2001 From: Larry Hastings Date: Fri, 8 May 2015 09:56:29 -0700 Subject: [PATCH] Issue #20274: When calling a _sqlite.Connection, it now complains if passed any keyword arguments. Previously it silently ignored them. Also: Remove ignored and erroneous "kwargs" parameters from three METH_VARARGS methods on _sqlite.Connection. --- Misc/NEWS | 6 ++++++ Modules/_sqlite/connection.c | 9 ++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS index fe16b3c789b6..e76f18710c31 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,12 @@ What's New in Python 2.7.10? Core and Builtins ----------------- +- Issue #20274: When calling a _sqlite.Connection, it now complains if passed + any keyword arguments. Previously it silently ignored them. + +- Issue #20274: Remove ignored and erroneous "kwargs" parameters from three + METH_VARARGS methods on _sqlite.Connection. + - Issue #23629: Fix the default __sizeof__ implementation for variable-sized objects. diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c index 0ed196d0e39e..79a7a0013c0f 100644 --- a/Modules/_sqlite/connection.c +++ b/Modules/_sqlite/connection.c @@ -1192,6 +1192,9 @@ PyObject* pysqlite_connection_call(pysqlite_Connection* self, PyObject* args, Py return NULL; } + if (!_PyArg_NoKeywords(MODULE_NAME ".Connection()", kwargs)) + return NULL; + if (!PyArg_ParseTuple(args, "O", &sql)) { return NULL; } @@ -1242,7 +1245,7 @@ error: return (PyObject*)statement; } -PyObject* pysqlite_connection_execute(pysqlite_Connection* self, PyObject* args, PyObject* kwargs) +PyObject* pysqlite_connection_execute(pysqlite_Connection* self, PyObject* args) { PyObject* cursor = 0; PyObject* result = 0; @@ -1271,7 +1274,7 @@ error: return cursor; } -PyObject* pysqlite_connection_executemany(pysqlite_Connection* self, PyObject* args, PyObject* kwargs) +PyObject* pysqlite_connection_executemany(pysqlite_Connection* self, PyObject* args) { PyObject* cursor = 0; PyObject* result = 0; @@ -1300,7 +1303,7 @@ error: return cursor; } -PyObject* pysqlite_connection_executescript(pysqlite_Connection* self, PyObject* args, PyObject* kwargs) +PyObject* pysqlite_connection_executescript(pysqlite_Connection* self, PyObject* args) { PyObject* cursor = 0; PyObject* result = 0; -- 2.47.3