Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prefix internal sqlite symbols with _pysqlite_ #8215

Merged
merged 1 commit into from
Jul 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Modules/_sqlite/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ void _pysqlite_func_callback(sqlite3_context* context, int argc, sqlite3_value**
Py_DECREF(py_retval);
}
if (!ok) {
if (_enable_callback_tracebacks) {
if (_pysqlite_enable_callback_tracebacks) {
PyErr_Print();
} else {
PyErr_Clear();
Expand Down Expand Up @@ -649,7 +649,7 @@ static void _pysqlite_step_callback(sqlite3_context *context, int argc, sqlite3_

if (PyErr_Occurred()) {
*aggregate_instance = 0;
if (_enable_callback_tracebacks) {
if (_pysqlite_enable_callback_tracebacks) {
PyErr_Print();
} else {
PyErr_Clear();
Expand All @@ -673,7 +673,7 @@ static void _pysqlite_step_callback(sqlite3_context *context, int argc, sqlite3_
Py_DECREF(args);

if (!function_result) {
if (_enable_callback_tracebacks) {
if (_pysqlite_enable_callback_tracebacks) {
PyErr_Print();
} else {
PyErr_Clear();
Expand Down Expand Up @@ -723,7 +723,7 @@ void _pysqlite_final_callback(sqlite3_context* context)
Py_DECREF(function_result);
}
if (!ok) {
if (_enable_callback_tracebacks) {
if (_pysqlite_enable_callback_tracebacks) {
PyErr_Print();
} else {
PyErr_Clear();
Expand Down Expand Up @@ -907,7 +907,7 @@ static int _authorizer_callback(void* user_arg, int action, const char* arg1, co
ret = PyObject_CallFunction((PyObject*)user_arg, "issss", action, arg1, arg2, dbname, access_attempt_source);

if (ret == NULL) {
if (_enable_callback_tracebacks)
if (_pysqlite_enable_callback_tracebacks)
PyErr_Print();
else
PyErr_Clear();
Expand All @@ -918,7 +918,7 @@ static int _authorizer_callback(void* user_arg, int action, const char* arg1, co
if (PyLong_Check(ret)) {
rc = _PyLong_AsInt(ret);
if (rc == -1 && PyErr_Occurred()) {
if (_enable_callback_tracebacks)
if (_pysqlite_enable_callback_tracebacks)
PyErr_Print();
else
PyErr_Clear();
Expand All @@ -945,7 +945,7 @@ static int _progress_handler(void* user_arg)
ret = _PyObject_CallNoArg((PyObject*)user_arg);

if (!ret) {
if (_enable_callback_tracebacks) {
if (_pysqlite_enable_callback_tracebacks) {
PyErr_Print();
} else {
PyErr_Clear();
Expand Down Expand Up @@ -980,7 +980,7 @@ static void _trace_callback(void* user_arg, const char* statement_string)
if (ret) {
Py_DECREF(ret);
} else {
if (_enable_callback_tracebacks) {
if (_pysqlite_enable_callback_tracebacks) {
PyErr_Print();
} else {
PyErr_Clear();
Expand Down
4 changes: 2 additions & 2 deletions Modules/_sqlite/cursor.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ PyObject* _pysqlite_get_converter(PyObject* key)
return NULL;
}

retval = PyDict_GetItem(converters, upcase_key);
retval = PyDict_GetItem(_pysqlite_converters, upcase_key);
Py_DECREF(upcase_key);

return retval;
Expand Down Expand Up @@ -539,7 +539,7 @@ PyObject* _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject*
if (rc != SQLITE_DONE && rc != SQLITE_ROW) {
if (PyErr_Occurred()) {
/* there was an error that occurred in a user-defined callback */
if (_enable_callback_tracebacks) {
if (_pysqlite_enable_callback_tracebacks) {
PyErr_Print();
} else {
PyErr_Clear();
Expand Down
14 changes: 7 additions & 7 deletions Modules/_sqlite/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ PyObject *pysqlite_IntegrityError = NULL;
PyObject *pysqlite_DataError = NULL;
PyObject *pysqlite_NotSupportedError = NULL;

PyObject* converters = NULL;
int _enable_callback_tracebacks = 0;
PyObject* _pysqlite_converters = NULL;
int _pysqlite_enable_callback_tracebacks = 0;
int pysqlite_BaseTypeAdapted = 0;

static PyObject* module_connect(PyObject* self, PyObject* args, PyObject*
Expand Down Expand Up @@ -204,7 +204,7 @@ static PyObject* module_register_converter(PyObject* self, PyObject* args)
goto error;
}

if (PyDict_SetItem(converters, name, callable) != 0) {
if (PyDict_SetItem(_pysqlite_converters, name, callable) != 0) {
goto error;
}

Expand All @@ -222,7 +222,7 @@ Registers a converter with pysqlite. Non-standard.");

static PyObject* enable_callback_tracebacks(PyObject* self, PyObject* args)
{
if (!PyArg_ParseTuple(args, "i", &_enable_callback_tracebacks)) {
if (!PyArg_ParseTuple(args, "i", &_pysqlite_enable_callback_tracebacks)) {
return NULL;
}

Expand All @@ -236,12 +236,12 @@ Enable or disable callback functions throwing errors to stderr.");

static void converters_init(PyObject* dict)
{
converters = PyDict_New();
if (!converters) {
_pysqlite_converters = PyDict_New();
if (!_pysqlite_converters) {
return;
}

PyDict_SetItemString(dict, "converters", converters);
PyDict_SetItemString(dict, "converters", _pysqlite_converters);
}

static PyMethodDef module_methods[] = {
Expand Down
4 changes: 2 additions & 2 deletions Modules/_sqlite/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ extern PyObject* pysqlite_NotSupportedError;
* functions, that convert the SQL value to the appropriate Python value.
* The key is uppercase.
*/
extern PyObject* converters;
extern PyObject* _pysqlite_converters;

extern int _enable_callback_tracebacks;
extern int _pysqlite_enable_callback_tracebacks;
extern int pysqlite_BaseTypeAdapted;

#define PARSE_DECLTYPES 1
Expand Down