We don't need to expose cursor_init(), call tp_init() on the type instead.

This commit is contained in:
Oleksandr Shulgin 2016-03-08 18:23:32 +01:00
parent da6e061ee8
commit 1d52f34e60
3 changed files with 5 additions and 13 deletions

View File

@ -90,14 +90,11 @@ struct cursorObject {
/* C-callable functions in cursor_int.c and cursor_type.c */
HIDDEN int cursor_init(PyObject *obj, PyObject *args, PyObject *kwargs);
BORROWED HIDDEN PyObject *curs_get_cast(cursorObject *self, PyObject *oid);
HIDDEN void curs_reset(cursorObject *self);
HIDDEN int psyco_curs_withhold_set(cursorObject *self, PyObject *pyvalue);
HIDDEN int psyco_curs_scrollable_set(cursorObject *self, PyObject *pyvalue);
/* exception-raising macros */
#define EXC_IF_CURS_CLOSED(self) \
do { \

View File

@ -1901,7 +1901,7 @@ cursor_dealloc(PyObject* obj)
Py_TYPE(obj)->tp_free(obj);
}
int
static int
cursor_init(PyObject *obj, PyObject *args, PyObject *kwargs)
{
PyObject *conn;

View File

@ -244,8 +244,10 @@ static struct PyGetSetDef replicationCursorObject_getsets[] = {
};
static int
replicationCursor_setup(replicationCursorObject* self)
replicationCursor_init(PyObject *obj, PyObject *args, PyObject *kwargs)
{
replicationCursorObject *self = (replicationCursorObject *)obj;
self->started = 0;
self->consuming = 0;
self->decode = 0;
@ -254,14 +256,7 @@ replicationCursor_setup(replicationCursorObject* self)
self->flush_lsn = 0;
self->apply_lsn = 0;
return 0;
}
static int
replicationCursor_init(PyObject *obj, PyObject *args, PyObject *kwargs)
{
replicationCursor_setup((replicationCursorObject *)obj);
return cursor_init(obj, args, kwargs);
return cursorType.tp_init(obj, args, kwargs);
}
static PyObject *