diff Modules/_sqlite/statement.c @ 43651:003d35215ef2

#1316: remove redundant PyLong_Check calls when PyInt_Check was already called.
author Georg Brandl <georg@python.org>
date Tue, 23 Oct 2007 19:24:22 +0000
parents 8c10aac37037
children 0d462d789b18
line wrap: on
line diff
--- a/Modules/_sqlite/statement.c	Tue Oct 23 18:26:17 2007 +0000
+++ b/Modules/_sqlite/statement.c	Tue Oct 23 19:24:22 2007 +0000
@@ -80,9 +80,10 @@
 int pysqlite_statement_bind_parameter(pysqlite_Statement* self, int pos, PyObject* parameter)
 {
     int rc = SQLITE_OK;
-    long longval;
 #ifdef HAVE_LONG_LONG
     PY_LONG_LONG longlongval;
+#else
+    long longval;
 #endif
     const char* buffer;
     char* string;
@@ -91,14 +92,16 @@
 
     if (parameter == Py_None) {
         rc = sqlite3_bind_null(self->st, pos);
-    } else if (PyInt_CheckExact(parameter)) {
-        longval = PyInt_AsLong(parameter);
-        rc = sqlite3_bind_int64(self->st, pos, (sqlite_int64)longval);
 #ifdef HAVE_LONG_LONG
     } else if (PyLong_Check(parameter)) {
         longlongval = PyLong_AsLongLong(parameter);
         /* in the overflow error case, longlongval is -1, and an exception is set */
         rc = sqlite3_bind_int64(self->st, pos, (sqlite_int64)longlongval);
+#else
+    } else if (PyLong_Check(parameter)) {
+        longval = PyLong_AsLong(parameter);
+        /* in the overflow error case, longval is -1, and an exception is set */
+        rc = sqlite3_bind_int64(self->st, pos, (sqlite_int64)longval);
 #endif
     } else if (PyFloat_Check(parameter)) {
         rc = sqlite3_bind_double(self->st, pos, PyFloat_AsDouble(parameter));