summaryrefslogtreecommitdiffstats
path: root/Modules/_sqlite
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2011-10-09 08:38:36 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2011-10-09 08:38:36 (GMT)
commitafe55bba33a20f87a58f940186359237064b428f (patch)
tree66d64a1518d79c3d0e90c0a1d0080cd88e887d99 /Modules/_sqlite
parent67df285a3389c7fdb8c7bd301314ac45e17f8074 (diff)
downloadcpython-afe55bba33a20f87a58f940186359237064b428f.zip
cpython-afe55bba33a20f87a58f940186359237064b428f.tar.gz
cpython-afe55bba33a20f87a58f940186359237064b428f.tar.bz2
Add API for static strings, primarily good for identifiers.
Thanks to Konrad Schöbel and Jasper Schulz for helping with the mass-editing.
Diffstat (limited to 'Modules/_sqlite')
-rw-r--r--Modules/_sqlite/connection.c15
-rw-r--r--Modules/_sqlite/cursor.c3
-rw-r--r--Modules/_sqlite/microprotocols.c8
-rw-r--r--Modules/_sqlite/module.c3
4 files changed, 20 insertions, 9 deletions
diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c
index 310a27c..c2f218f 100644
--- a/Modules/_sqlite/connection.c
+++ b/Modules/_sqlite/connection.c
@@ -675,6 +675,7 @@ void _pysqlite_final_callback(sqlite3_context* context)
{
PyObject* function_result = NULL;
PyObject** aggregate_instance;
+ _Py_identifier(finalize);
#ifdef WITH_THREAD
PyGILState_STATE threadstate;
@@ -690,7 +691,7 @@ void _pysqlite_final_callback(sqlite3_context* context)
goto error;
}
- function_result = PyObject_CallMethod(*aggregate_instance, "finalize", "");
+ function_result = _PyObject_CallMethodId(*aggregate_instance, &PyId_finalize, "");
if (!function_result) {
if (_enable_callback_tracebacks) {
PyErr_Print();
@@ -1230,8 +1231,9 @@ PyObject* pysqlite_connection_execute(pysqlite_Connection* self, PyObject* args,
PyObject* cursor = 0;
PyObject* result = 0;
PyObject* method = 0;
+ _Py_identifier(cursor);
- cursor = PyObject_CallMethod((PyObject*)self, "cursor", "");
+ cursor = _PyObject_CallMethodId((PyObject*)self, &PyId_cursor, "");
if (!cursor) {
goto error;
}
@@ -1259,8 +1261,9 @@ PyObject* pysqlite_connection_executemany(pysqlite_Connection* self, PyObject* a
PyObject* cursor = 0;
PyObject* result = 0;
PyObject* method = 0;
+ _Py_identifier(cursor);
- cursor = PyObject_CallMethod((PyObject*)self, "cursor", "");
+ cursor = _PyObject_CallMethodId((PyObject*)self, &PyId_cursor, "");
if (!cursor) {
goto error;
}
@@ -1288,8 +1291,9 @@ PyObject* pysqlite_connection_executescript(pysqlite_Connection* self, PyObject*
PyObject* cursor = 0;
PyObject* result = 0;
PyObject* method = 0;
+ _Py_identifier(cursor);
- cursor = PyObject_CallMethod((PyObject*)self, "cursor", "");
+ cursor = _PyObject_CallMethodId((PyObject*)self, &PyId_cursor, "");
if (!cursor) {
goto error;
}
@@ -1437,6 +1441,7 @@ pysqlite_connection_create_collation(pysqlite_Connection* self, PyObject* args)
PyObject* name;
PyObject* retval;
Py_ssize_t i, len;
+ _Py_identifier(upper);
char *uppercase_name_str;
int rc;
unsigned int kind;
@@ -1450,7 +1455,7 @@ pysqlite_connection_create_collation(pysqlite_Connection* self, PyObject* args)
goto finally;
}
- uppercase_name = PyObject_CallMethod(name, "upper", "");
+ uppercase_name = _PyObject_CallMethodId(name, &PyId_upper, "");
if (!uppercase_name) {
goto finally;
}
diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c
index 264ae45..b47fed4 100644
--- a/Modules/_sqlite/cursor.c
+++ b/Modules/_sqlite/cursor.c
@@ -150,8 +150,9 @@ PyObject* _pysqlite_get_converter(PyObject* key)
{
PyObject* upcase_key;
PyObject* retval;
+ _Py_identifier(upper);
- upcase_key = PyObject_CallMethod(key, "upper", "");
+ upcase_key = _PyObject_CallMethodId(key, &PyId_upper, "");
if (!upcase_key) {
return NULL;
}
diff --git a/Modules/_sqlite/microprotocols.c b/Modules/_sqlite/microprotocols.c
index c730afa..c0f5e22 100644
--- a/Modules/_sqlite/microprotocols.c
+++ b/Modules/_sqlite/microprotocols.c
@@ -95,7 +95,9 @@ pysqlite_microprotocols_adapt(PyObject *obj, PyObject *proto, PyObject *alt)
/* try to have the protocol adapt this object*/
if (PyObject_HasAttrString(proto, "__adapt__")) {
- PyObject *adapted = PyObject_CallMethod(proto, "__adapt__", "O", obj);
+ _Py_identifier(__adapt__);
+ PyObject *adapted = _PyObject_CallMethodId(proto, &PyId___adapt__, "O", obj);
+
if (adapted) {
if (adapted != Py_None) {
return adapted;
@@ -110,7 +112,9 @@ pysqlite_microprotocols_adapt(PyObject *obj, PyObject *proto, PyObject *alt)
/* and finally try to have the object adapt itself */
if (PyObject_HasAttrString(obj, "__conform__")) {
- PyObject *adapted = PyObject_CallMethod(obj, "__conform__","O", proto);
+ _Py_identifier(__conform__);
+ PyObject *adapted = _PyObject_CallMethodId(obj, &PyId___conform__,"O", proto);
+
if (adapted) {
if (adapted != Py_None) {
return adapted;
diff --git a/Modules/_sqlite/module.c b/Modules/_sqlite/module.c
index cbc3b8e..20e1ec7 100644
--- a/Modules/_sqlite/module.c
+++ b/Modules/_sqlite/module.c
@@ -179,13 +179,14 @@ static PyObject* module_register_converter(PyObject* self, PyObject* args)
PyObject* name = NULL;
PyObject* callable;
PyObject* retval = NULL;
+ _Py_identifier(upper);
if (!PyArg_ParseTuple(args, "UO", &orig_name, &callable)) {
return NULL;
}
/* convert the name to upper case */
- name = PyObject_CallMethod(orig_name, "upper", "");
+ name = _PyObject_CallMethodId(orig_name, &PyId_upper, "");
if (!name) {
goto error;
}