mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-11 03:26:37 +03:00
Piet Delport patches: 3 of 3.
This commit is contained in:
parent
474d8b9d51
commit
1d8af808bf
10
ChangeLog
10
ChangeLog
|
@ -1,5 +1,13 @@
|
|||
2006-09-23 Federico Di Gregorio <fog@initd.org>
|
||||
|
||||
|
||||
* Applied patch 1/3 from Piet Delport; from his email:
|
||||
psycopg2-Py_ssize_t-input.diff adjusts variables used for parameters
|
||||
and return values. These changes only prevent overflowing on values
|
||||
greater than 32-bits, so they're not as critical as the other two
|
||||
patches. I tried to leave places unchanged where the input size is
|
||||
already constrained to sizeof(int), but i might have missed a few
|
||||
either way, not being too familiar with the codebase.
|
||||
|
||||
* Applied patch 2/3 from Piet Delport; from his email:
|
||||
psycopg2-Py_ssize_t-output.diff adjusts variables used as outputs
|
||||
from CPython API calls: without it the calls try to write 64 bits
|
||||
|
|
|
@ -40,7 +40,7 @@ list_quote(listObject *self)
|
|||
/* adapt the list by calling adapt() recursively and then wrapping
|
||||
everything into "ARRAY[]" */
|
||||
PyObject *tmp = NULL, *str = NULL, *joined = NULL, *res = NULL;
|
||||
int i, len;
|
||||
Py_ssize_t i, len;
|
||||
|
||||
len = PyList_GET_SIZE(self->wrapped);
|
||||
|
||||
|
|
|
@ -77,7 +77,8 @@ _mogrify(PyObject *var, PyObject *fmt, connectionObject *conn, PyObject **new)
|
|||
{
|
||||
PyObject *key, *value, *n, *item;
|
||||
char *d, *c;
|
||||
int index = 0, force = 0;
|
||||
Py_ssize_t index = 0;
|
||||
int force = 0;
|
||||
|
||||
/* from now on we'll use n and replace its value in *new only at the end,
|
||||
just before returning. we also init *new to NULL to exit with an error
|
||||
|
@ -872,7 +873,7 @@ psyco_curs_callproc(cursorObject *self, PyObject *args, PyObject *kwargs)
|
|||
{
|
||||
char *procname = NULL, *sql = NULL;
|
||||
long int async = 0;
|
||||
int i, nparameters = 0, sl = 0;
|
||||
Py_ssize_t i, nparameters = 0, sl = 0;
|
||||
PyObject *parameters = NULL;
|
||||
PyObject *operation = NULL;
|
||||
PyObject *res = NULL;
|
||||
|
|
|
@ -586,7 +586,8 @@ _pq_copy_in_v3(cursorObject *curs)
|
|||
uses the new PQputCopyData() and can detect errors and set the correct
|
||||
exception */
|
||||
PyObject *o;
|
||||
int length = 0, error = 0;
|
||||
Py_ssize_t length = 0;
|
||||
int error = 0;
|
||||
|
||||
while (1) {
|
||||
o = PyObject_CallMethod(curs->copyfile, "read", "i", curs->copysize);
|
||||
|
|
|
@ -267,7 +267,7 @@ int
|
|||
typecast_add(PyObject *obj, int binary)
|
||||
{
|
||||
PyObject *val;
|
||||
int len, i;
|
||||
Py_ssize_t len, i;
|
||||
|
||||
typecastObject *type = (typecastObject *)obj;
|
||||
|
||||
|
@ -302,7 +302,8 @@ typecast_cmp(PyObject *obj1, PyObject* obj2)
|
|||
typecastObject *self = (typecastObject*)obj1;
|
||||
typecastObject *other = NULL;
|
||||
PyObject *number = NULL;
|
||||
int i, j, res = -1;
|
||||
Py_ssize_t i, j;
|
||||
int res = -1;
|
||||
|
||||
if (PyObject_TypeCheck(obj2, &typecastType)) {
|
||||
other = (typecastObject*)obj2;
|
||||
|
@ -505,7 +506,7 @@ typecast_from_c(typecastObject_initlist *type, PyObject *dict)
|
|||
{
|
||||
PyObject *tuple, *base = NULL;
|
||||
typecastObject *obj;
|
||||
int i, len = 0;
|
||||
Py_ssize_t i, len = 0;
|
||||
|
||||
/* before doing anything else we look for the base */
|
||||
if (type->base) {
|
||||
|
@ -538,7 +539,7 @@ typecast_from_c(typecastObject_initlist *type, PyObject *dict)
|
|||
}
|
||||
|
||||
PyObject *
|
||||
typecast_cast(PyObject *obj, char *str, int len, PyObject *curs)
|
||||
typecast_cast(PyObject *obj, char *str, Py_ssize_t len, PyObject *curs)
|
||||
{
|
||||
PyObject *old, *res = NULL;
|
||||
typecastObject *self = (typecastObject *)obj;
|
||||
|
|
|
@ -80,6 +80,6 @@ extern PyObject *typecast_from_python(
|
|||
|
||||
/* the function used to dispatch typecasting calls */
|
||||
extern PyObject *typecast_cast(
|
||||
PyObject *self, char *str, int len, PyObject *curs);
|
||||
PyObject *self, char *str, Py_ssize_t len, PyObject *curs);
|
||||
|
||||
#endif /* !defined(PSYCOPG_TYPECAST_H) */
|
||||
|
|
Loading…
Reference in New Issue
Block a user