mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-01-31 09:24:07 +03:00
Dropped GC support from Xid and Notify types
These types are immutable and have only atomic types attributes, so it's impossible to build loops out of them.
This commit is contained in:
parent
5aafe38fd7
commit
7328aaf0fb
|
@ -79,30 +79,18 @@ notify_init(notifyObject *self, PyObject *args, PyObject *kwargs)
|
|||
payload = Text_FromUTF8("");
|
||||
}
|
||||
|
||||
Py_CLEAR(self->pid);
|
||||
Py_INCREF(pid);
|
||||
self->pid = pid;
|
||||
|
||||
Py_CLEAR(self->channel);
|
||||
Py_INCREF(channel);
|
||||
self->channel = channel;
|
||||
|
||||
Py_CLEAR(self->payload);
|
||||
Py_INCREF(payload);
|
||||
self->payload = payload;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
notify_traverse(notifyObject *self, visitproc visit, void *arg)
|
||||
{
|
||||
Py_VISIT(self->pid);
|
||||
Py_VISIT(self->channel);
|
||||
Py_VISIT(self->payload);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
notify_dealloc(notifyObject *self)
|
||||
{
|
||||
|
@ -286,9 +274,10 @@ PyTypeObject notifyType = {
|
|||
0, /*tp_getattro*/
|
||||
0, /*tp_setattro*/
|
||||
0, /*tp_as_buffer*/
|
||||
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
|
||||
/* Notify is not GC as it only has string attributes */
|
||||
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /*tp_flags*/
|
||||
notify_doc, /*tp_doc*/
|
||||
(traverseproc)notify_traverse, /*tp_traverse*/
|
||||
0, /*tp_traverse*/
|
||||
0, /*tp_clear*/
|
||||
(richcmpfunc)notify_richcompare, /*tp_richcompare*/
|
||||
0, /*tp_weaklistoffset*/
|
||||
|
|
|
@ -131,9 +131,9 @@ xid_init(xidObject *self, PyObject *args, PyObject *kwargs)
|
|||
}
|
||||
}
|
||||
|
||||
self->format_id = PyInt_FromLong(format_id);
|
||||
self->gtrid = Text_FromUTF8(gtrid);
|
||||
self->bqual = Text_FromUTF8(bqual);
|
||||
if (!(self->format_id = PyInt_FromLong(format_id))) { return -1; }
|
||||
if (!(self->gtrid = Text_FromUTF8(gtrid))) { return -1; }
|
||||
if (!(self->bqual = Text_FromUTF8(bqual))) { return -1; }
|
||||
Py_INCREF(Py_None); self->prepared = Py_None;
|
||||
Py_INCREF(Py_None); self->owner = Py_None;
|
||||
Py_INCREF(Py_None); self->database = Py_None;
|
||||
|
@ -141,18 +141,6 @@ xid_init(xidObject *self, PyObject *args, PyObject *kwargs)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
xid_traverse(xidObject *self, visitproc visit, void *arg)
|
||||
{
|
||||
Py_VISIT(self->format_id);
|
||||
Py_VISIT(self->gtrid);
|
||||
Py_VISIT(self->bqual);
|
||||
Py_VISIT(self->prepared);
|
||||
Py_VISIT(self->owner);
|
||||
Py_VISIT(self->database);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
xid_dealloc(xidObject *self)
|
||||
{
|
||||
|
@ -295,9 +283,10 @@ PyTypeObject xidType = {
|
|||
0, /*tp_getattro*/
|
||||
0, /*tp_setattro*/
|
||||
0, /*tp_as_buffer*/
|
||||
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
|
||||
/* Notify is not GC as it only has string attributes */
|
||||
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /*tp_flags*/
|
||||
xid_doc, /*tp_doc*/
|
||||
(traverseproc)xid_traverse, /*tp_traverse*/
|
||||
0, /*tp_traverse*/
|
||||
0, /*tp_clear*/
|
||||
0, /*tp_richcompare*/
|
||||
0, /*tp_weaklistoffset*/
|
||||
|
|
Loading…
Reference in New Issue
Block a user