[Python-checkins] cpython (2.7): Issue #20274: When calling a _sqlite.Connection, it now complains if passed

larry.hastings python-checkins at python.org
Fri May 8 18:56:48 CEST 2015


https://hg.python.org/cpython/rev/c91d135b0776
changeset:   95917:c91d135b0776
branch:      2.7
parent:      95900:e8783c581928
user:        Larry Hastings <larry at hastings.org>
date:        Fri May 08 09:56:29 2015 -0700
summary:
  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.

files:
  Misc/NEWS                    |  6 ++++++
  Modules/_sqlite/connection.c |  9 ++++++---
  2 files changed, 12 insertions(+), 3 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,12 @@
 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
--- a/Modules/_sqlite/connection.c
+++ b/Modules/_sqlite/connection.c
@@ -1192,6 +1192,9 @@
         return NULL;
     }
 
+    if (!_PyArg_NoKeywords(MODULE_NAME ".Connection()", kwargs))
+        return NULL;
+
     if (!PyArg_ParseTuple(args, "O", &sql)) {
         return NULL;
     }
@@ -1242,7 +1245,7 @@
     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 @@
     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 @@
     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;

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list