mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-22 08:56:34 +03:00
parent
391386cfb9
commit
8ea5d0c0b8
3
NEWS
3
NEWS
|
@ -13,7 +13,8 @@ What's new in psycopg 2.9
|
||||||
What's new in psycopg 2.8.7
|
What's new in psycopg 2.8.7
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Accept empty params as `~psycopg2.connect()` (:ticket:`#1250).
|
- Accept empty params as `~psycopg2.connect()` (:ticket:`#1250).
|
||||||
|
- Fix attributes refcount in `Column` initialisation (:ticket:`#1252`).
|
||||||
|
|
||||||
|
|
||||||
What's new in psycopg 2.8.6
|
What's new in psycopg 2.8.6
|
||||||
|
|
|
@ -97,17 +97,36 @@ column_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
||||||
static int
|
static int
|
||||||
column_init(columnObject *self, PyObject *args, PyObject *kwargs)
|
column_init(columnObject *self, PyObject *args, PyObject *kwargs)
|
||||||
{
|
{
|
||||||
|
PyObject *name = NULL;
|
||||||
|
PyObject *type_code = NULL;
|
||||||
|
PyObject *display_size = NULL;
|
||||||
|
PyObject *internal_size = NULL;
|
||||||
|
PyObject *precision = NULL;
|
||||||
|
PyObject *scale = NULL;
|
||||||
|
PyObject *null_ok = NULL;
|
||||||
|
PyObject *table_oid = NULL;
|
||||||
|
PyObject *table_column = NULL;
|
||||||
|
|
||||||
static char *kwlist[] = {
|
static char *kwlist[] = {
|
||||||
"name", "type_code", "display_size", "internal_size",
|
"name", "type_code", "display_size", "internal_size",
|
||||||
"precision", "scale", "null_ok", "table_oid", "table_column", NULL};
|
"precision", "scale", "null_ok", "table_oid", "table_column", NULL};
|
||||||
|
|
||||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OOOOOOOOO", kwlist,
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OOOOOOOOO", kwlist,
|
||||||
&self->name, &self->type_code, &self->display_size,
|
&name, &type_code, &display_size, &internal_size, &precision,
|
||||||
&self->internal_size, &self->precision, &self->scale,
|
&scale, &null_ok, &table_oid, &table_column)) {
|
||||||
&self->null_ok, &self->table_oid, &self->table_column)) {
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Py_XINCREF(name); self->name = name;
|
||||||
|
Py_XINCREF(type_code); self->type_code = type_code;
|
||||||
|
Py_XINCREF(display_size); self->display_size = display_size;
|
||||||
|
Py_XINCREF(internal_size); self->internal_size = internal_size;
|
||||||
|
Py_XINCREF(precision); self->precision = precision;
|
||||||
|
Py_XINCREF(scale); self->scale = scale;
|
||||||
|
Py_XINCREF(null_ok); self->null_ok = null_ok;
|
||||||
|
Py_XINCREF(table_oid); self->table_oid = table_oid;
|
||||||
|
Py_XINCREF(table_column); self->table_column = table_column;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -250,6 +250,16 @@ class CursorTests(ConnectingTestCase):
|
||||||
|
|
||||||
self.assertEqual(description, unpickled)
|
self.assertEqual(description, unpickled)
|
||||||
|
|
||||||
|
def test_column_refcount(self):
|
||||||
|
# Reproduce crash describe in ticket #1252
|
||||||
|
from psycopg2.extensions import Column
|
||||||
|
|
||||||
|
def do_stuff():
|
||||||
|
_ = Column(name='my_column')
|
||||||
|
|
||||||
|
for _ in range(1000):
|
||||||
|
do_stuff()
|
||||||
|
|
||||||
def test_bad_subclass(self):
|
def test_bad_subclass(self):
|
||||||
# check that we get an error message instead of a segfault
|
# check that we get an error message instead of a segfault
|
||||||
# for badly written subclasses.
|
# for badly written subclasses.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user