Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 16915a0

Browse filesBrowse files
authored
Remove fileno, escape_sequence, and escape_dict from Connection (PyMySQL#297)
1 parent dff668c commit 16915a0
Copy full SHA for 16915a0

File tree

Expand file treeCollapse file tree

3 files changed

+5
-98
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+5
-98
lines changed

‎HISTORY.rst

Copy file name to clipboardExpand all lines: HISTORY.rst
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ Release: TBD
1818

1919
* Remove ``waiter`` option from Connection.
2020

21+
* Remove ``fileno``, ``escape_sequence``, and ``escape_dict`` methods
22+
from Connection class.
23+
2124
======================
2225
What's new in 1.3.14
2326
======================

‎MySQLdb/__init__.py

Copy file name to clipboardExpand all lines: MySQLdb/__init__.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def Connect(*args, **kwargs):
9393
'MySQLError', 'NULL', 'NUMBER', 'NotSupportedError', 'DBAPISet',
9494
'OperationalError', 'ProgrammingError', 'ROWID', 'STRING', 'TIME',
9595
'TIMESTAMP', 'Warning', 'apilevel', 'connect', 'connections',
96-
'constants', 'converters', 'cursors', 'debug', 'escape', 'escape_dict',
97-
'escape_sequence', 'escape_string', 'get_client_info',
96+
'constants', 'converters', 'cursors', 'debug', 'escape',
97+
'escape_string', 'get_client_info',
9898
'paramstyle', 'string_literal', 'threadsafety', 'version_info']
9999

‎MySQLdb/_mysql.c

Copy file name to clipboardExpand all lines: MySQLdb/_mysql.c
-96Lines changed: 0 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -607,17 +607,6 @@ static int _mysql_ConnectionObject_clear(
607607
return 0;
608608
}
609609

610-
static char _mysql_ConnectionObject_fileno__doc__[] =
611-
"Return underlaying fd for connection (deprecated)";
612-
613-
static PyObject *
614-
_mysql_ConnectionObject_fileno(
615-
_mysql_ConnectionObject *self)
616-
{
617-
check_connection(self);
618-
return PyInt_FromLong(self->connection.net.fd);
619-
}
620-
621610
static char _mysql_ConnectionObject_close__doc__[] =
622611
"Close the connection. No further activity possible.";
623612

@@ -1036,71 +1025,6 @@ _mysql_escape(
10361025
}
10371026
}
10381027

1039-
static char _mysql_escape_sequence__doc__[] =
1040-
"escape_sequence(seq, dict) -- escape any special characters in sequence\n\
1041-
seq using mapping dict to provide quoting functions for each type.\n\
1042-
Returns a tuple of escaped items.";
1043-
static PyObject *
1044-
_mysql_escape_sequence(
1045-
PyObject *self,
1046-
PyObject *args)
1047-
{
1048-
PyObject *o=NULL, *d=NULL, *r=NULL, *item, *quoted;
1049-
int i, n;
1050-
if (!PyArg_ParseTuple(args, "OO:escape_sequence", &o, &d))
1051-
goto error;
1052-
if (!PyMapping_Check(d)) {
1053-
PyErr_SetString(PyExc_TypeError,
1054-
"argument 2 must be a mapping");
1055-
return NULL;
1056-
}
1057-
if ((n = PyObject_Length(o)) == -1) goto error;
1058-
if (!(r = PyTuple_New(n))) goto error;
1059-
for (i=0; i<n; i++) {
1060-
item = PySequence_GetItem(o, i);
1061-
if (!item) goto error;
1062-
quoted = _escape_item(item, d);
1063-
Py_DECREF(item);
1064-
if (!quoted) goto error;
1065-
PyTuple_SET_ITEM(r, i, quoted);
1066-
}
1067-
return r;
1068-
error:
1069-
Py_XDECREF(r);
1070-
return NULL;
1071-
}
1072-
1073-
static char _mysql_escape_dict__doc__[] =
1074-
"escape_sequence(d, dict) -- escape any special characters in\n\
1075-
dictionary d using mapping dict to provide quoting functions for each type.\n\
1076-
Returns a dictionary of escaped items.";
1077-
static PyObject *
1078-
_mysql_escape_dict(
1079-
PyObject *self,
1080-
PyObject *args)
1081-
{
1082-
PyObject *o=NULL, *d=NULL, *r=NULL, *item, *quoted, *pkey;
1083-
Py_ssize_t ppos = 0;
1084-
if (!PyArg_ParseTuple(args, "O!O:escape_dict", &PyDict_Type, &o, &d))
1085-
goto error;
1086-
if (!PyMapping_Check(d)) {
1087-
PyErr_SetString(PyExc_TypeError,
1088-
"argument 2 must be a mapping");
1089-
return NULL;
1090-
}
1091-
if (!(r = PyDict_New())) goto error;
1092-
while (PyDict_Next(o, &ppos, &pkey, &item)) {
1093-
quoted = _escape_item(item, d);
1094-
if (!quoted) goto error;
1095-
if (PyDict_SetItem(r, pkey, quoted)==-1) goto error;
1096-
Py_DECREF(quoted);
1097-
}
1098-
return r;
1099-
error:
1100-
Py_XDECREF(r);
1101-
return NULL;
1102-
}
1103-
11041028
static char _mysql_ResultObject_describe__doc__[] =
11051029
"Returns the sequence of 7-tuples required by the DB-API for\n\
11061030
the Cursor.description attribute.\n\
@@ -2169,12 +2093,6 @@ static PyMethodDef _mysql_ConnectionObject_methods[] = {
21692093
METH_NOARGS,
21702094
_mysql_ConnectionObject_close__doc__
21712095
},
2172-
{
2173-
"fileno",
2174-
(PyCFunction)_mysql_ConnectionObject_fileno,
2175-
METH_NOARGS,
2176-
_mysql_ConnectionObject_fileno__doc__
2177-
},
21782096
{
21792097
"dump_debug_info",
21802098
(PyCFunction)_mysql_ConnectionObject_dump_debug_info,
@@ -2612,20 +2530,6 @@ _mysql_methods[] = {
26122530
METH_VARARGS,
26132531
_mysql_escape__doc__
26142532
},
2615-
{
2616-
// deprecated.
2617-
"escape_sequence",
2618-
(PyCFunction)_mysql_escape_sequence,
2619-
METH_VARARGS,
2620-
_mysql_escape_sequence__doc__
2621-
},
2622-
{
2623-
// deprecated.
2624-
"escape_dict",
2625-
(PyCFunction)_mysql_escape_dict,
2626-
METH_VARARGS,
2627-
_mysql_escape_dict__doc__
2628-
},
26292533
{
26302534
"escape_string",
26312535
(PyCFunction)_mysql_escape_string,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.