summaryrefslogtreecommitdiffstats
path: root/Modules/_sqlite/module.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_sqlite/module.c')
-rw-r--r--Modules/_sqlite/module.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/Modules/_sqlite/module.c b/Modules/_sqlite/module.c
index cbc3b8e..bea6d6a 100644
--- a/Modules/_sqlite/module.c
+++ b/Modules/_sqlite/module.c
@@ -37,7 +37,7 @@
PyObject* pysqlite_Error, *pysqlite_Warning, *pysqlite_InterfaceError, *pysqlite_DatabaseError,
*pysqlite_InternalError, *pysqlite_OperationalError, *pysqlite_ProgrammingError,
- *pysqlite_IntegrityError, *pysqlite_DataError, *pysqlite_NotSupportedError, *pysqlite_OptimizedUnicode;
+ *pysqlite_IntegrityError, *pysqlite_DataError, *pysqlite_NotSupportedError;
PyObject* converters;
int _enable_callback_tracebacks;
@@ -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;
}
@@ -406,13 +407,13 @@ PyMODINIT_FUNC PyInit__sqlite3(void)
}
PyDict_SetItemString(dict, "NotSupportedError", pysqlite_NotSupportedError);
- /* We just need "something" unique for pysqlite_OptimizedUnicode. It does not really
- * need to be a string subclass. Just anything that can act as a special
- * marker for us. So I pulled PyCell_Type out of my magic hat.
- */
- Py_INCREF((PyObject*)&PyCell_Type);
- pysqlite_OptimizedUnicode = (PyObject*)&PyCell_Type;
- PyDict_SetItemString(dict, "OptimizedUnicode", pysqlite_OptimizedUnicode);
+ /* In Python 2.x, setting Connection.text_factory to
+ OptimizedUnicode caused Unicode objects to be returned for
+ non-ASCII data and bytestrings to be returned for ASCII data.
+ Now OptimizedUnicode is an alias for str, so it has no
+ effect. */
+ Py_INCREF((PyObject*)&PyUnicode_Type);
+ PyDict_SetItemString(dict, "OptimizedUnicode", (PyObject*)&PyUnicode_Type);
/* Set integer constants */
for (i = 0; _int_constants[i].constant_name != 0; i++) {