mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-07-28 08:59:59 +03:00
Fixes #1252 - Increment refcount on provided parameters.
When parsing an object (`O`) with `PyArg_ParseTuple` and friends, the provided object is set in the appropiate field, but the refcount is not incremented. Reference: https://docs.python.org/3/c-api/arg.html#other-objects. Use `Py_XINCREF` to increment the refcount on any objects that may have been passed into this function. `Py_XINCREF` performs a NULL check internally and only increments the refcounter on non-NULL objects.
This commit is contained in:
parent
f469331af5
commit
91d240160f
|
@ -108,6 +108,16 @@ column_init(columnObject *self, PyObject *args, PyObject *kwargs)
|
|||
return -1;
|
||||
}
|
||||
|
||||
Py_XINCREF(self->name);
|
||||
Py_XINCREF(self->type_code);
|
||||
Py_XINCREF(self->display_size);
|
||||
Py_XINCREF(self->internal_size);
|
||||
Py_XINCREF(self->precision);
|
||||
Py_XINCREF(self->scale);
|
||||
Py_XINCREF(self->null_ok);
|
||||
Py_XINCREF(self->table_oid);
|
||||
Py_XINCREF(self->table_column);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user