diff --git a/psycopg/cursor.h b/psycopg/cursor.h index 5170900f..e291d45f 100644 --- a/psycopg/cursor.h +++ b/psycopg/cursor.h @@ -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 { \ diff --git a/psycopg/cursor_type.c b/psycopg/cursor_type.c index 63bd5a10..cd8d5ca3 100644 --- a/psycopg/cursor_type.c +++ b/psycopg/cursor_type.c @@ -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; diff --git a/psycopg/replication_cursor_type.c b/psycopg/replication_cursor_type.c index f652984e..8d96c0e1 100644 --- a/psycopg/replication_cursor_type.c +++ b/psycopg/replication_cursor_type.c @@ -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 *