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

use PY_SSIZE_T_CLEAN #360

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

Merged
merged 2 commits into from
Jun 8, 2019
Merged
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: 10 additions & 6 deletions 16 MySQLdb/_mysql.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ PERFORMANCE OF THIS SOFTWARE.
#define my_bool _Bool
#endif

#define PY_SSIZE_T_CLEAN 1
#include "Python.h"
#if PY_MAJOR_VERSION >= 3
#define IS_PY3K
Expand Down Expand Up @@ -879,7 +880,8 @@ _mysql_escape_string(
{
PyObject *str;
char *in, *out;
int len, size;
int len;
Py_ssize_t size;
if (!PyArg_ParseTuple(args, "s#:escape_string", &in, &size)) return NULL;
str = PyBytes_FromStringAndSize((char *) NULL, size*2+1);
if (!str) return PyErr_NoMemory();
Expand Down Expand Up @@ -1099,7 +1101,7 @@ static PyObject *
_mysql_field_to_python(
PyObject *converter,
const char *rowitem,
unsigned long length,
Py_ssize_t length,
MYSQL_FIELD *field,
const char *encoding)
{
Expand Down Expand Up @@ -1153,10 +1155,10 @@ _mysql_field_to_python(
}
return PyObject_CallFunction(converter,
binary ? "y#" : "s#",
rowitem, (int)length);
rowitem, (Py_ssize_t)length);
#else
return PyObject_CallFunction(converter,
"s#", rowitem, (int)length);
"s#", rowitem, (Py_ssize_t)length);
#endif
}

Expand Down Expand Up @@ -1748,7 +1750,8 @@ _mysql_ConnectionObject_query(
PyObject *args)
{
char *query;
int len, r;
Py_ssize_t len;
int r;
if (!PyArg_ParseTuple(args, "s#:query", &query, &len)) return NULL;
check_connection(self);

Expand All @@ -1770,7 +1773,8 @@ _mysql_ConnectionObject_send_query(
PyObject *args)
{
char *query;
int len, r;
Py_ssize_t len;
int r;
MYSQL *mysql = &(self->connection);
if (!PyArg_ParseTuple(args, "s#:query", &query, &len)) return NULL;
check_connection(self);
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.