diff --git a/psycopg/adapter_datetime.c b/psycopg/adapter_datetime.c index a340c9b4..663338f3 100644 --- a/psycopg/adapter_datetime.c +++ b/psycopg/adapter_datetime.c @@ -36,7 +36,7 @@ RAISES_NEG int -psyco_adapter_datetime_init(void) +adapter_datetime_init(void) { PyDateTime_IMPORT; diff --git a/psycopg/adapter_datetime.h b/psycopg/adapter_datetime.h index eb0fc920..b6afa09d 100644 --- a/psycopg/adapter_datetime.h +++ b/psycopg/adapter_datetime.h @@ -45,7 +45,7 @@ typedef struct { } pydatetimeObject; -RAISES_NEG HIDDEN int psyco_adapter_datetime_init(void); +RAISES_NEG HIDDEN int adapter_datetime_init(void); HIDDEN PyObject *psyco_Date(PyObject *module, PyObject *args); #define psyco_Date_doc \ diff --git a/psycopg/connection_type.c b/psycopg/connection_type.c index f4d650b5..18ddb66c 100644 --- a/psycopg/connection_type.c +++ b/psycopg/connection_type.c @@ -112,10 +112,10 @@ psyco_conn_cursor(connectionObject *self, PyObject *args, PyObject *kwargs) goto exit; } - if (0 > psyco_curs_withhold_set((cursorObject *)obj, withhold)) { + if (0 > curs_withhold_set((cursorObject *)obj, withhold)) { goto exit; } - if (0 > psyco_curs_scrollable_set((cursorObject *)obj, scrollable)) { + if (0 > curs_scrollable_set((cursorObject *)obj, scrollable)) { goto exit; } diff --git a/psycopg/cursor.h b/psycopg/cursor.h index bc91cbb0..d74069a4 100644 --- a/psycopg/cursor.h +++ b/psycopg/cursor.h @@ -93,9 +93,9 @@ struct cursorObject { /* C-callable functions in cursor_int.c and cursor_type.c */ BORROWED HIDDEN PyObject *curs_get_cast(cursorObject *self, PyObject *oid); HIDDEN void curs_reset(cursorObject *self); -RAISES_NEG HIDDEN int psyco_curs_withhold_set(cursorObject *self, PyObject *pyvalue); -RAISES_NEG HIDDEN int psyco_curs_scrollable_set(cursorObject *self, PyObject *pyvalue); -HIDDEN PyObject *psyco_curs_validate_sql_basic(cursorObject *self, PyObject *sql); +RAISES_NEG HIDDEN int curs_withhold_set(cursorObject *self, PyObject *pyvalue); +RAISES_NEG HIDDEN int curs_scrollable_set(cursorObject *self, PyObject *pyvalue); +HIDDEN PyObject *curs_validate_sql_basic(cursorObject *self, PyObject *sql); HIDDEN void curs_set_result(cursorObject *self, PGresult *pgres); /* exception-raising macros */ diff --git a/psycopg/cursor_int.c b/psycopg/cursor_int.c index 453bf619..57824c23 100644 --- a/psycopg/cursor_int.c +++ b/psycopg/cursor_int.c @@ -108,7 +108,7 @@ exit: * after having set an exception. */ PyObject * -psyco_curs_validate_sql_basic(cursorObject *self, PyObject *sql) +curs_validate_sql_basic(cursorObject *self, PyObject *sql) { PyObject *rv = NULL; PyObject *comp = NULL; diff --git a/psycopg/cursor_type.c b/psycopg/cursor_type.c index 0d10e61f..c9b49800 100644 --- a/psycopg/cursor_type.c +++ b/psycopg/cursor_type.c @@ -43,11 +43,11 @@ /* close method - close the cursor */ -#define psyco_curs_close_doc \ +#define curs_close_doc \ "close() -- Close the cursor." static PyObject * -psyco_curs_close(cursorObject *self, PyObject *dummy) +curs_close(cursorObject *self, PyObject *dummy) { PyObject *rv = NULL; char *lname = NULL; @@ -110,7 +110,7 @@ close: CLEARPGRES(self->pgres); self->closed = 1; - Dprintf("psyco_curs_close: cursor at %p closed", self); + Dprintf("curs_close: cursor at %p closed", self); rv = Py_None; Py_INCREF(rv); @@ -335,7 +335,7 @@ _psyco_curs_merge_query_args(cursorObject *self, PyErr_Fetch(&err, &arg, &trace); if (err && PyErr_GivenExceptionMatches(err, PyExc_TypeError)) { - Dprintf("psyco_curs_execute: TypeError exception caught"); + Dprintf("curs_execute: TypeError exception caught"); PyErr_NormalizeException(&err, &arg, &trace); if (PyObject_HasAttrString(arg, "args")) { @@ -343,11 +343,11 @@ _psyco_curs_merge_query_args(cursorObject *self, PyObject *str = PySequence_GetItem(args, 0); const char *s = Bytes_AS_STRING(str); - Dprintf("psyco_curs_execute: -> %s", s); + Dprintf("curs_execute: -> %s", s); if (!strcmp(s, "not enough arguments for format string") || !strcmp(s, "not all arguments converted")) { - Dprintf("psyco_curs_execute: -> got a match"); + Dprintf("curs_execute: -> got a match"); psyco_set_error(ProgrammingError, self, s); pe = 1; } @@ -369,7 +369,7 @@ _psyco_curs_merge_query_args(cursorObject *self, return fquery; } -#define psyco_curs_execute_doc \ +#define curs_execute_doc \ "execute(query, vars=None) -- Execute query with bound vars." RAISES_NEG static int @@ -382,13 +382,13 @@ _psyco_curs_execute(cursorObject *self, PyObject *fquery = NULL, *cvt = NULL; /* query becomes NULL or refcount +1, so good to XDECREF at the end */ - if (!(query = psyco_curs_validate_sql_basic(self, query))) { + if (!(query = curs_validate_sql_basic(self, query))) { goto exit; } CLEARPGRES(self->pgres); Py_CLEAR(self->query); - Dprintf("psyco_curs_execute: starting execution of new query"); + Dprintf("curs_execute: starting execution of new query"); /* here we are, and we have a sequence or a dictionary filled with objects to be substituted (bound variables). we try to be smart and do @@ -444,7 +444,7 @@ _psyco_curs_execute(cursorObject *self, /* At this point, the SQL statement must be str, not unicode */ tmp = pq_execute(self, Bytes_AS_STRING(self->query), async, no_result, 0); - Dprintf("psyco_curs_execute: res = %d, pgres = %p", tmp, self->pgres); + Dprintf("curs_execute: res = %d, pgres = %p", tmp, self->pgres); if (tmp < 0) { goto exit; } res = 0; /* Success */ @@ -458,7 +458,7 @@ exit: } static PyObject * -psyco_curs_execute(cursorObject *self, PyObject *args, PyObject *kwargs) +curs_execute(cursorObject *self, PyObject *args, PyObject *kwargs) { PyObject *vars = NULL, *operation = NULL; @@ -495,11 +495,11 @@ psyco_curs_execute(cursorObject *self, PyObject *args, PyObject *kwargs) Py_RETURN_NONE; } -#define psyco_curs_executemany_doc \ +#define curs_executemany_doc \ "executemany(query, vars_list) -- Execute many queries with bound vars." static PyObject * -psyco_curs_executemany(cursorObject *self, PyObject *args, PyObject *kwargs) +curs_executemany(cursorObject *self, PyObject *args, PyObject *kwargs) { PyObject *operation = NULL, *vars = NULL; PyObject *v, *iter = NULL; @@ -556,7 +556,7 @@ psyco_curs_executemany(cursorObject *self, PyObject *args, PyObject *kwargs) } -#define psyco_curs_mogrify_doc \ +#define curs_mogrify_doc \ "mogrify(query, vars=None) -> str -- Return query after vars binding." static PyObject * @@ -565,10 +565,10 @@ _psyco_curs_mogrify(cursorObject *self, { PyObject *fquery = NULL, *cvt = NULL; - operation = psyco_curs_validate_sql_basic(self, operation); + operation = curs_validate_sql_basic(self, operation); if (operation == NULL) { goto cleanup; } - Dprintf("psyco_curs_mogrify: starting mogrify"); + Dprintf("curs_mogrify: starting mogrify"); /* here we are, and we have a sequence or a dictionary filled with objects to be substituted (bound variables). we try to be smart and do @@ -586,7 +586,7 @@ _psyco_curs_mogrify(cursorObject *self, goto cleanup; } - Dprintf("psyco_curs_mogrify: cvt->refcnt = " FORMAT_CODE_PY_SSIZE_T + Dprintf("curs_mogrify: cvt->refcnt = " FORMAT_CODE_PY_SSIZE_T ", fquery->refcnt = " FORMAT_CODE_PY_SSIZE_T, Py_REFCNT(cvt), Py_REFCNT(fquery)); } @@ -603,7 +603,7 @@ cleanup: } static PyObject * -psyco_curs_mogrify(cursorObject *self, PyObject *args, PyObject *kwargs) +curs_mogrify(cursorObject *self, PyObject *args, PyObject *kwargs) { PyObject *vars = NULL, *operation = NULL; @@ -619,7 +619,7 @@ psyco_curs_mogrify(cursorObject *self, PyObject *args, PyObject *kwargs) /* cast method - convert an oid/string into a Python object */ -#define psyco_curs_cast_doc \ +#define curs_cast_doc \ "cast(oid, s) -> value\n\n" \ "Convert the string s to a Python object according to its oid.\n\n" \ "Look for a typecaster first in the cursor, then in its connection," \ @@ -627,7 +627,7 @@ psyco_curs_mogrify(cursorObject *self, PyObject *args, PyObject *kwargs) "leave the value as a string." static PyObject * -psyco_curs_cast(cursorObject *self, PyObject *args) +curs_cast(cursorObject *self, PyObject *args) { PyObject *oid; PyObject *s; @@ -643,7 +643,7 @@ psyco_curs_cast(cursorObject *self, PyObject *args) /* fetchone method - fetch one row of results */ -#define psyco_curs_fetchone_doc \ +#define curs_fetchone_doc \ "fetchone() -> tuple or None\n\n" \ "Return the next row of a query result set in the form of a tuple (by\n" \ "default) or using the sequence factory previously set in the\n" \ @@ -744,7 +744,7 @@ exit: } static PyObject * -psyco_curs_fetchone(cursorObject *self, PyObject *dummy) +curs_fetchone(cursorObject *self, PyObject *dummy) { PyObject *res; @@ -763,8 +763,8 @@ psyco_curs_fetchone(cursorObject *self, PyObject *dummy) if (_psyco_curs_prefetch(self) < 0) return NULL; } - Dprintf("psyco_curs_fetchone: fetching row %ld", self->row); - Dprintf("psyco_curs_fetchone: rowcount = %ld", self->rowcount); + Dprintf("curs_fetchone: fetching row %ld", self->row); + Dprintf("curs_fetchone: rowcount = %ld", self->rowcount); if (self->row >= self->rowcount) { /* we exausted available data: return None */ @@ -789,11 +789,11 @@ psyco_curs_fetchone(cursorObject *self, PyObject *dummy) * Fetch several records at time. Return NULL when the cursor is exhausted. */ static PyObject * -psyco_curs_next_named(cursorObject *self) +curs_next_named(cursorObject *self) { PyObject *res; - Dprintf("psyco_curs_next_named"); + Dprintf("curs_next_named"); EXC_IF_CURS_CLOSED(self); EXC_IF_ASYNC_IN_PROGRESS(self, next); if (_psyco_curs_prefetch(self) < 0) return NULL; @@ -802,8 +802,8 @@ psyco_curs_next_named(cursorObject *self) EXC_IF_NO_MARK(self); EXC_IF_TPC_PREPARED(self->conn, next); - Dprintf("psyco_curs_next_named: row %ld", self->row); - Dprintf("psyco_curs_next_named: rowcount = %ld", self->rowcount); + Dprintf("curs_next_named: row %ld", self->row); + Dprintf("curs_next_named: rowcount = %ld", self->rowcount); if (self->row >= self->rowcount) { char buffer[128]; @@ -834,7 +834,7 @@ psyco_curs_next_named(cursorObject *self) /* fetch many - fetch some results */ -#define psyco_curs_fetchmany_doc \ +#define curs_fetchmany_doc \ "fetchmany(size=self.arraysize) -> list of tuple\n\n" \ "Return the next `size` rows of a query result set in the form of a list\n" \ "of tuples (by default) or using the sequence factory previously set in\n" \ @@ -842,7 +842,7 @@ psyco_curs_next_named(cursorObject *self) "Return an empty list when no more data is available.\n" static PyObject * -psyco_curs_fetchmany(cursorObject *self, PyObject *args, PyObject *kwords) +curs_fetchmany(cursorObject *self, PyObject *args, PyObject *kwords) { int i; PyObject *list = NULL; @@ -887,7 +887,7 @@ psyco_curs_fetchmany(cursorObject *self, PyObject *args, PyObject *kwords) size = self->rowcount - self->row; } - Dprintf("psyco_curs_fetchmany: size = %ld", size); + Dprintf("curs_fetchmany: size = %ld", size); if (size <= 0) { rv = PyList_New(0); @@ -927,7 +927,7 @@ exit: /* fetch all - fetch all results */ -#define psyco_curs_fetchall_doc \ +#define curs_fetchall_doc \ "fetchall() -> list of tuple\n\n" \ "Return all the remaining rows of a query result set.\n\n" \ "Rows are returned in the form of a list of tuples (by default) or using\n" \ @@ -935,7 +935,7 @@ exit: "Return `!None` when no more data is available.\n" static PyObject * -psyco_curs_fetchall(cursorObject *self, PyObject *dummy) +curs_fetchall(cursorObject *self, PyObject *dummy) { int i, size; PyObject *list = NULL; @@ -996,11 +996,11 @@ exit: /* callproc method - execute a stored procedure */ -#define psyco_curs_callproc_doc \ +#define curs_callproc_doc \ "callproc(procname, parameters=None) -- Execute stored procedure." static PyObject * -psyco_curs_callproc(cursorObject *self, PyObject *args) +curs_callproc(cursorObject *self, PyObject *args) { const char *procname = NULL; char *sql = NULL; @@ -1144,13 +1144,13 @@ exit: /* nextset method - return the next set of data (not supported) */ -#define psyco_curs_nextset_doc \ +#define curs_nextset_doc \ "nextset() -- Skip to next set of data.\n\n" \ "This method is not supported (PostgreSQL does not have multiple data \n" \ "sets) and will raise a NotSupportedError exception." static PyObject * -psyco_curs_nextset(cursorObject *self, PyObject *dummy) +curs_nextset(cursorObject *self, PyObject *dummy) { EXC_IF_CURS_CLOSED(self); @@ -1161,12 +1161,12 @@ psyco_curs_nextset(cursorObject *self, PyObject *dummy) /* setinputsizes - predefine memory areas for execute (does nothing) */ -#define psyco_curs_setinputsizes_doc \ +#define curs_setinputsizes_doc \ "setinputsizes(sizes) -- Set memory areas before execute.\n\n" \ "This method currently does nothing but it is safe to call it." static PyObject * -psyco_curs_setinputsizes(cursorObject *self, PyObject *args) +curs_setinputsizes(cursorObject *self, PyObject *args) { PyObject *sizes; @@ -1181,12 +1181,12 @@ psyco_curs_setinputsizes(cursorObject *self, PyObject *args) /* setoutputsize - predefine memory areas for execute (does nothing) */ -#define psyco_curs_setoutputsize_doc \ +#define curs_setoutputsize_doc \ "setoutputsize(size, column=None) -- Set column buffer size.\n\n" \ "This method currently does nothing but it is safe to call it." static PyObject * -psyco_curs_setoutputsize(cursorObject *self, PyObject *args) +curs_setoutputsize(cursorObject *self, PyObject *args) { long int size, column; @@ -1201,11 +1201,11 @@ psyco_curs_setoutputsize(cursorObject *self, PyObject *args) /* scroll - scroll position in result list */ -#define psyco_curs_scroll_doc \ +#define curs_scroll_doc \ "scroll(value, mode='relative') -- Scroll to new position according to mode." static PyObject * -psyco_curs_scroll(cursorObject *self, PyObject *args, PyObject *kwargs) +curs_scroll(cursorObject *self, PyObject *args, PyObject *kwargs) { int value, newpos; const char *mode = "relative"; @@ -1263,21 +1263,21 @@ psyco_curs_scroll(cursorObject *self, PyObject *args, PyObject *kwargs) } -#define psyco_curs_enter_doc \ +#define curs_enter_doc \ "__enter__ -> self" static PyObject * -psyco_curs_enter(cursorObject *self, PyObject *dummy) +curs_enter(cursorObject *self, PyObject *dummy) { Py_INCREF(self); return (PyObject *)self; } -#define psyco_curs_exit_doc \ +#define curs_exit_doc \ "__exit__ -- close the cursor" static PyObject * -psyco_curs_exit(cursorObject *self, PyObject *args) +curs_exit(cursorObject *self, PyObject *args) { PyObject *tmp = NULL; PyObject *rv = NULL; @@ -1379,11 +1379,11 @@ exit: /* extension: copy_from - implements COPY FROM */ -#define psyco_curs_copy_from_doc \ +#define curs_copy_from_doc \ "copy_from(file, table, sep='\\t', null='\\\\N', size=8192, columns=None) -- Copy table from file." static PyObject * -psyco_curs_copy_from(cursorObject *self, PyObject *args, PyObject *kwargs) +curs_copy_from(cursorObject *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "file", "table", "sep", "null", "size", "columns", NULL}; @@ -1443,10 +1443,10 @@ psyco_curs_copy_from(cursorObject *self, PyObject *args, PyObject *kwargs) PyOS_snprintf(query, query_size, command, table_name, columnlist, quoted_delimiter, quoted_null); - Dprintf("psyco_curs_copy_from: query = %s", query); + Dprintf("curs_copy_from: query = %s", query); /* This routine stores a borrowed reference. Although it is only held - * for the duration of psyco_curs_copy_from, nested invocations of + * for the duration of curs_copy_from, nested invocations of * Py_BEGIN_ALLOW_THREADS could surrender control to another thread, * which could invoke the garbage collector. We thus need an * INCREF/DECREF pair if we store this pointer in a GC object, such as @@ -1473,11 +1473,11 @@ exit: /* extension: copy_to - implements COPY TO */ -#define psyco_curs_copy_to_doc \ +#define curs_copy_to_doc \ "copy_to(file, table, sep='\\t', null='\\\\N', columns=None) -- Copy table to file." static PyObject * -psyco_curs_copy_to(cursorObject *self, PyObject *args, PyObject *kwargs) +curs_copy_to(cursorObject *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = {"file", "table", "sep", "null", "columns", NULL}; @@ -1535,7 +1535,7 @@ psyco_curs_copy_to(cursorObject *self, PyObject *args, PyObject *kwargs) PyOS_snprintf(query, query_size, command, table_name, columnlist, quoted_delimiter, quoted_null); - Dprintf("psyco_curs_copy_to: query = %s", query); + Dprintf("curs_copy_to: query = %s", query); self->copysize = 0; Py_INCREF(file); @@ -1563,7 +1563,7 @@ exit: SQL statement, rather than composing the statement from parameters. */ -#define psyco_curs_copy_expert_doc \ +#define curs_copy_expert_doc \ "copy_expert(sql, file, size=8192) -- Submit a user-composed COPY statement.\n" \ "`file` must be an open, readable file for COPY FROM or an open, writable\n" \ "file for COPY TO. The optional `size` argument, when specified for a COPY\n" \ @@ -1571,7 +1571,7 @@ exit: "buffer size." static PyObject * -psyco_curs_copy_expert(cursorObject *self, PyObject *args, PyObject *kwargs) +curs_copy_expert(cursorObject *self, PyObject *args, PyObject *kwargs) { Py_ssize_t bufsize = DEFAULT_COPYBUFF; PyObject *sql, *file, *res = NULL; @@ -1587,7 +1587,7 @@ psyco_curs_copy_expert(cursorObject *self, PyObject *args, PyObject *kwargs) EXC_IF_GREEN(copy_expert); EXC_IF_TPC_PREPARED(self->conn, copy_expert); - sql = psyco_curs_validate_sql_basic(self, sql); + sql = curs_validate_sql_basic(self, sql); /* Any failure from here forward should 'goto exit' rather than 'return NULL' directly. */ @@ -1630,28 +1630,28 @@ exit: /* extension: closed - return true if cursor is closed */ -#define psyco_curs_closed_doc \ +#define curs_closed_doc \ "True if cursor is closed, False if cursor is open" static PyObject * -psyco_curs_get_closed(cursorObject *self, void *closure) +curs_closed_get(cursorObject *self, void *closure) { return PyBool_FromLong(self->closed || (self->conn && self->conn->closed)); } /* extension: withhold - get or set "WITH HOLD" for named cursors */ -#define psyco_curs_withhold_doc \ +#define curs_withhold_doc \ "Set or return cursor use of WITH HOLD" static PyObject * -psyco_curs_withhold_get(cursorObject *self) +curs_withhold_get(cursorObject *self) { return PyBool_FromLong(self->withhold); } RAISES_NEG int -psyco_curs_withhold_set(cursorObject *self, PyObject *pyvalue) +curs_withhold_set(cursorObject *self, PyObject *pyvalue) { int value; @@ -1669,11 +1669,11 @@ psyco_curs_withhold_set(cursorObject *self, PyObject *pyvalue) return 0; } -#define psyco_curs_scrollable_doc \ +#define curs_scrollable_doc \ "Set or return cursor use of SCROLL" static PyObject * -psyco_curs_scrollable_get(cursorObject *self) +curs_scrollable_get(cursorObject *self) { PyObject *ret = NULL; @@ -1696,7 +1696,7 @@ psyco_curs_scrollable_get(cursorObject *self) } RAISES_NEG int -psyco_curs_scrollable_set(cursorObject *self, PyObject *pyvalue) +curs_scrollable_set(cursorObject *self, PyObject *pyvalue) { int value; @@ -1718,11 +1718,11 @@ psyco_curs_scrollable_set(cursorObject *self, PyObject *pyvalue) } -#define psyco_curs_pgresult_ptr_doc \ +#define curs_pgresult_ptr_doc \ "pgresult_ptr -- Get the PGresult structure pointer." static PyObject * -psyco_curs_pgresult_ptr_get(cursorObject *self) +curs_pgresult_ptr_get(cursorObject *self) { if (self->pgres) { return PyLong_FromVoidPtr((void *)self->pgres); @@ -1751,8 +1751,8 @@ cursor_next(PyObject *self) PyObject *res; if (NULL == ((cursorObject*)self)->name) { - /* we don't parse arguments: psyco_curs_fetchone will do that for us */ - res = psyco_curs_fetchone((cursorObject*)self, NULL); + /* we don't parse arguments: curs_fetchone will do that for us */ + res = curs_fetchone((cursorObject*)self, NULL); /* convert a None to NULL to signal the end of iteration */ if (res && res == Py_None) { @@ -1761,7 +1761,7 @@ cursor_next(PyObject *self) } } else { - res = psyco_curs_next_named((cursorObject*)self); + res = curs_next_named((cursorObject*)self); } return res; @@ -1771,44 +1771,44 @@ cursor_next(PyObject *self) static struct PyMethodDef cursorObject_methods[] = { /* DBAPI-2.0 core */ - {"close", (PyCFunction)psyco_curs_close, - METH_NOARGS, psyco_curs_close_doc}, - {"execute", (PyCFunction)psyco_curs_execute, - METH_VARARGS|METH_KEYWORDS, psyco_curs_execute_doc}, - {"executemany", (PyCFunction)psyco_curs_executemany, - METH_VARARGS|METH_KEYWORDS, psyco_curs_executemany_doc}, - {"fetchone", (PyCFunction)psyco_curs_fetchone, - METH_NOARGS, psyco_curs_fetchone_doc}, - {"fetchmany", (PyCFunction)psyco_curs_fetchmany, - METH_VARARGS|METH_KEYWORDS, psyco_curs_fetchmany_doc}, - {"fetchall", (PyCFunction)psyco_curs_fetchall, - METH_NOARGS, psyco_curs_fetchall_doc}, - {"callproc", (PyCFunction)psyco_curs_callproc, - METH_VARARGS, psyco_curs_callproc_doc}, - {"nextset", (PyCFunction)psyco_curs_nextset, - METH_NOARGS, psyco_curs_nextset_doc}, - {"setinputsizes", (PyCFunction)psyco_curs_setinputsizes, - METH_VARARGS, psyco_curs_setinputsizes_doc}, - {"setoutputsize", (PyCFunction)psyco_curs_setoutputsize, - METH_VARARGS, psyco_curs_setoutputsize_doc}, + {"close", (PyCFunction)curs_close, + METH_NOARGS, curs_close_doc}, + {"execute", (PyCFunction)curs_execute, + METH_VARARGS|METH_KEYWORDS, curs_execute_doc}, + {"executemany", (PyCFunction)curs_executemany, + METH_VARARGS|METH_KEYWORDS, curs_executemany_doc}, + {"fetchone", (PyCFunction)curs_fetchone, + METH_NOARGS, curs_fetchone_doc}, + {"fetchmany", (PyCFunction)curs_fetchmany, + METH_VARARGS|METH_KEYWORDS, curs_fetchmany_doc}, + {"fetchall", (PyCFunction)curs_fetchall, + METH_NOARGS, curs_fetchall_doc}, + {"callproc", (PyCFunction)curs_callproc, + METH_VARARGS, curs_callproc_doc}, + {"nextset", (PyCFunction)curs_nextset, + METH_NOARGS, curs_nextset_doc}, + {"setinputsizes", (PyCFunction)curs_setinputsizes, + METH_VARARGS, curs_setinputsizes_doc}, + {"setoutputsize", (PyCFunction)curs_setoutputsize, + METH_VARARGS, curs_setoutputsize_doc}, /* DBAPI-2.0 extensions */ - {"scroll", (PyCFunction)psyco_curs_scroll, - METH_VARARGS|METH_KEYWORDS, psyco_curs_scroll_doc}, - {"__enter__", (PyCFunction)psyco_curs_enter, - METH_NOARGS, psyco_curs_enter_doc}, - {"__exit__", (PyCFunction)psyco_curs_exit, - METH_VARARGS, psyco_curs_exit_doc}, + {"scroll", (PyCFunction)curs_scroll, + METH_VARARGS|METH_KEYWORDS, curs_scroll_doc}, + {"__enter__", (PyCFunction)curs_enter, + METH_NOARGS, curs_enter_doc}, + {"__exit__", (PyCFunction)curs_exit, + METH_VARARGS, curs_exit_doc}, /* psycopg extensions */ - {"cast", (PyCFunction)psyco_curs_cast, - METH_VARARGS, psyco_curs_cast_doc}, - {"mogrify", (PyCFunction)psyco_curs_mogrify, - METH_VARARGS|METH_KEYWORDS, psyco_curs_mogrify_doc}, - {"copy_from", (PyCFunction)psyco_curs_copy_from, - METH_VARARGS|METH_KEYWORDS, psyco_curs_copy_from_doc}, - {"copy_to", (PyCFunction)psyco_curs_copy_to, - METH_VARARGS|METH_KEYWORDS, psyco_curs_copy_to_doc}, - {"copy_expert", (PyCFunction)psyco_curs_copy_expert, - METH_VARARGS|METH_KEYWORDS, psyco_curs_copy_expert_doc}, + {"cast", (PyCFunction)curs_cast, + METH_VARARGS, curs_cast_doc}, + {"mogrify", (PyCFunction)curs_mogrify, + METH_VARARGS|METH_KEYWORDS, curs_mogrify_doc}, + {"copy_from", (PyCFunction)curs_copy_from, + METH_VARARGS|METH_KEYWORDS, curs_copy_from_doc}, + {"copy_to", (PyCFunction)curs_copy_to, + METH_VARARGS|METH_KEYWORDS, curs_copy_to_doc}, + {"copy_expert", (PyCFunction)curs_copy_expert, + METH_VARARGS|METH_KEYWORDS, curs_copy_expert_doc}, {NULL} }; @@ -1849,19 +1849,19 @@ static struct PyMemberDef cursorObject_members[] = { /* object calculated member list */ static struct PyGetSetDef cursorObject_getsets[] = { - { "closed", (getter)psyco_curs_get_closed, NULL, - psyco_curs_closed_doc, NULL }, + { "closed", (getter)curs_closed_get, NULL, + curs_closed_doc, NULL }, { "withhold", - (getter)psyco_curs_withhold_get, - (setter)psyco_curs_withhold_set, - psyco_curs_withhold_doc, NULL }, + (getter)curs_withhold_get, + (setter)curs_withhold_set, + curs_withhold_doc, NULL }, { "scrollable", - (getter)psyco_curs_scrollable_get, - (setter)psyco_curs_scrollable_set, - psyco_curs_scrollable_doc, NULL }, + (getter)curs_scrollable_get, + (setter)curs_scrollable_set, + curs_scrollable_doc, NULL }, { "pgresult_ptr", - (getter)psyco_curs_pgresult_ptr_get, NULL, - psyco_curs_pgresult_ptr_doc, NULL }, + (getter)curs_pgresult_ptr_get, NULL, + curs_pgresult_ptr_doc, NULL }, {NULL} }; diff --git a/psycopg/diagnostics_type.c b/psycopg/diagnostics_type.c index efde9109..efbce5f2 100644 --- a/psycopg/diagnostics_type.c +++ b/psycopg/diagnostics_type.c @@ -61,7 +61,7 @@ * If the cursor or its result isn't available, return None. */ static PyObject * -psyco_diagnostics_get_field(diagnosticsObject *self, void *closure) +diagnostics_get_field(diagnosticsObject *self, void *closure) { const char *errortext; @@ -76,41 +76,41 @@ psyco_diagnostics_get_field(diagnosticsObject *self, void *closure) /* object calculated member list */ static struct PyGetSetDef diagnosticsObject_getsets[] = { - { "severity", (getter)psyco_diagnostics_get_field, NULL, + { "severity", (getter)diagnostics_get_field, NULL, NULL, (void*) PG_DIAG_SEVERITY }, - { "severity_nonlocalized", (getter)psyco_diagnostics_get_field, NULL, + { "severity_nonlocalized", (getter)diagnostics_get_field, NULL, NULL, (void*) PG_DIAG_SEVERITY_NONLOCALIZED }, - { "sqlstate", (getter)psyco_diagnostics_get_field, NULL, + { "sqlstate", (getter)diagnostics_get_field, NULL, NULL, (void*) PG_DIAG_SQLSTATE }, - { "message_primary", (getter)psyco_diagnostics_get_field, NULL, + { "message_primary", (getter)diagnostics_get_field, NULL, NULL, (void*) PG_DIAG_MESSAGE_PRIMARY }, - { "message_detail", (getter)psyco_diagnostics_get_field, NULL, + { "message_detail", (getter)diagnostics_get_field, NULL, NULL, (void*) PG_DIAG_MESSAGE_DETAIL }, - { "message_hint", (getter)psyco_diagnostics_get_field, NULL, + { "message_hint", (getter)diagnostics_get_field, NULL, NULL, (void*) PG_DIAG_MESSAGE_HINT }, - { "statement_position", (getter)psyco_diagnostics_get_field, NULL, + { "statement_position", (getter)diagnostics_get_field, NULL, NULL, (void*) PG_DIAG_STATEMENT_POSITION }, - { "internal_position", (getter)psyco_diagnostics_get_field, NULL, + { "internal_position", (getter)diagnostics_get_field, NULL, NULL, (void*) PG_DIAG_INTERNAL_POSITION }, - { "internal_query", (getter)psyco_diagnostics_get_field, NULL, + { "internal_query", (getter)diagnostics_get_field, NULL, NULL, (void*) PG_DIAG_INTERNAL_QUERY }, - { "context", (getter)psyco_diagnostics_get_field, NULL, + { "context", (getter)diagnostics_get_field, NULL, NULL, (void*) PG_DIAG_CONTEXT }, - { "schema_name", (getter)psyco_diagnostics_get_field, NULL, + { "schema_name", (getter)diagnostics_get_field, NULL, NULL, (void*) PG_DIAG_SCHEMA_NAME }, - { "table_name", (getter)psyco_diagnostics_get_field, NULL, + { "table_name", (getter)diagnostics_get_field, NULL, NULL, (void*) PG_DIAG_TABLE_NAME }, - { "column_name", (getter)psyco_diagnostics_get_field, NULL, + { "column_name", (getter)diagnostics_get_field, NULL, NULL, (void*) PG_DIAG_COLUMN_NAME }, - { "datatype_name", (getter)psyco_diagnostics_get_field, NULL, + { "datatype_name", (getter)diagnostics_get_field, NULL, NULL, (void*) PG_DIAG_DATATYPE_NAME }, - { "constraint_name", (getter)psyco_diagnostics_get_field, NULL, + { "constraint_name", (getter)diagnostics_get_field, NULL, NULL, (void*) PG_DIAG_CONSTRAINT_NAME }, - { "source_file", (getter)psyco_diagnostics_get_field, NULL, + { "source_file", (getter)diagnostics_get_field, NULL, NULL, (void*) PG_DIAG_SOURCE_FILE }, - { "source_line", (getter)psyco_diagnostics_get_field, NULL, + { "source_line", (getter)diagnostics_get_field, NULL, NULL, (void*) PG_DIAG_SOURCE_LINE }, - { "source_function", (getter)psyco_diagnostics_get_field, NULL, + { "source_function", (getter)diagnostics_get_field, NULL, NULL, (void*) PG_DIAG_SOURCE_FUNCTION }, {NULL} }; diff --git a/psycopg/error_type.c b/psycopg/error_type.c index 3edba7a8..226ba18e 100644 --- a/psycopg/error_type.c +++ b/psycopg/error_type.c @@ -229,7 +229,7 @@ static struct PyGetSetDef error_getsets[] = { * would require implementing __getstate__, and as of 2012 it's a little * bit too late to care. */ static PyObject * -psyco_error_reduce(errorObject *self, PyObject *dummy) +error_reduce(errorObject *self, PyObject *dummy) { PyObject *meth = NULL; PyObject *tuple = NULL; @@ -288,7 +288,7 @@ error: } PyObject * -psyco_error_setstate(errorObject *self, PyObject *state) +error_setstate(errorObject *self, PyObject *state) { PyObject *rv = NULL; @@ -326,8 +326,8 @@ error: static PyMethodDef error_methods[] = { /* Make Error and all its subclasses picklable. */ - {"__reduce__", (PyCFunction)psyco_error_reduce, METH_NOARGS }, - {"__setstate__", (PyCFunction)psyco_error_setstate, METH_O }, + {"__reduce__", (PyCFunction)error_reduce, METH_NOARGS }, + {"__setstate__", (PyCFunction)error_setstate, METH_O }, {NULL} }; diff --git a/psycopg/microprotocols_proto.c b/psycopg/microprotocols_proto.c index 80c22a84..dbad99a6 100644 --- a/psycopg/microprotocols_proto.c +++ b/psycopg/microprotocols_proto.c @@ -36,33 +36,33 @@ /* getquoted - return quoted representation for object */ -#define psyco_isqlquote_getquoted_doc \ +#define isqlquote_getquoted_doc \ "getquoted() -- return SQL-quoted representation of this object" static PyObject * -psyco_isqlquote_getquoted(isqlquoteObject *self, PyObject *args) +isqlquote_getquoted(isqlquoteObject *self, PyObject *args) { Py_RETURN_NONE; } /* getbinary - return quoted representation for object */ -#define psyco_isqlquote_getbinary_doc \ +#define isqlquote_getbinary_doc \ "getbinary() -- return SQL-quoted binary representation of this object" static PyObject * -psyco_isqlquote_getbinary(isqlquoteObject *self, PyObject *args) +isqlquote_getbinary(isqlquoteObject *self, PyObject *args) { Py_RETURN_NONE; } /* getbuffer - return quoted representation for object */ -#define psyco_isqlquote_getbuffer_doc \ +#define isqlquote_getbuffer_doc \ "getbuffer() -- return this object" static PyObject * -psyco_isqlquote_getbuffer(isqlquoteObject *self, PyObject *args) +isqlquote_getbuffer(isqlquoteObject *self, PyObject *args) { Py_RETURN_NONE; } @@ -75,14 +75,12 @@ psyco_isqlquote_getbuffer(isqlquoteObject *self, PyObject *args) /* object method list */ static struct PyMethodDef isqlquoteObject_methods[] = { - {"getquoted", (PyCFunction)psyco_isqlquote_getquoted, - METH_NOARGS, psyco_isqlquote_getquoted_doc}, - {"getbinary", (PyCFunction)psyco_isqlquote_getbinary, - METH_NOARGS, psyco_isqlquote_getbinary_doc}, - {"getbuffer", (PyCFunction)psyco_isqlquote_getbuffer, - METH_NOARGS, psyco_isqlquote_getbuffer_doc}, - /* {"prepare", (PyCFunction)psyco_isqlquote_prepare, - METH_VARARGS, psyco_isqlquote_prepare_doc}, */ + {"getquoted", (PyCFunction)isqlquote_getquoted, + METH_NOARGS, isqlquote_getquoted_doc}, + {"getbinary", (PyCFunction)isqlquote_getbinary, + METH_NOARGS, isqlquote_getbinary_doc}, + {"getbuffer", (PyCFunction)isqlquote_getbuffer, + METH_NOARGS, isqlquote_getbuffer_doc}, {NULL} }; diff --git a/psycopg/psycopgmodule.c b/psycopg/psycopgmodule.c index 003904c8..b66d8078 100644 --- a/psycopg/psycopgmodule.c +++ b/psycopg/psycopgmodule.c @@ -76,11 +76,11 @@ HIDDEN PyObject *psyco_null = NULL; #define str(s) #s /** connect module-level function **/ -#define psyco_connect_doc \ +#define connect_doc \ "_connect(dsn, [connection_factory], [async]) -- New database connection.\n\n" static PyObject * -psyco_connect(PyObject *self, PyObject *args, PyObject *keywds) +connect(PyObject *self, PyObject *args, PyObject *keywds) { PyObject *conn = NULL; PyObject *factory = NULL; @@ -96,7 +96,7 @@ psyco_connect(PyObject *self, PyObject *args, PyObject *keywds) if (async_) { async = async_; } - Dprintf("psyco_connect: dsn = '%s', async = %d", dsn, async); + Dprintf("connect: dsn = '%s', async = %d", dsn, async); /* allocate connection, fill with errors and return it */ if (factory == NULL || factory == Py_None) { @@ -120,11 +120,11 @@ psyco_connect(PyObject *self, PyObject *args, PyObject *keywds) } -#define psyco_parse_dsn_doc \ +#define parse_dsn_doc \ "parse_dsn(dsn) -> dict -- parse a connection string into parameters" static PyObject * -psyco_parse_dsn(PyObject *self, PyObject *args, PyObject *kwargs) +parse_dsn(PyObject *self, PyObject *args, PyObject *kwargs) { char *err = NULL; PQconninfoOption *options = NULL; @@ -159,14 +159,14 @@ exit: } -#define psyco_quote_ident_doc \ +#define quote_ident_doc \ "quote_ident(str, conn_or_curs) -> str -- wrapper around PQescapeIdentifier\n\n" \ ":Parameters:\n" \ " * `str`: A bytes or unicode object\n" \ " * `conn_or_curs`: A connection or cursor, required" static PyObject * -psyco_quote_ident(PyObject *self, PyObject *args, PyObject *kwargs) +quote_ident(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject *ident = NULL, *obj = NULL, *result = NULL; connectionObject *conn; @@ -205,7 +205,7 @@ exit: } /** type registration **/ -#define psyco_register_type_doc \ +#define register_type_doc \ "register_type(obj, conn_or_curs) -> None -- register obj with psycopg type system\n\n" \ ":Parameters:\n" \ " * `obj`: A type adapter created by `new_type()`\n" \ @@ -233,7 +233,7 @@ exit: " * `baseobj`: Adapter to perform type conversion of a single array item." static PyObject * -psyco_register_type(PyObject *self, PyObject *args) +register_type(PyObject *self, PyObject *args) { PyObject *type, *obj = NULL; @@ -271,7 +271,7 @@ psyco_register_type(PyObject *self, PyObject *args) /* Make sure libcrypto thread callbacks are set up. */ static void -psyco_libcrypto_threads_init(void) +libcrypto_threads_init(void) { PyObject *m; @@ -406,20 +406,20 @@ exit: return rv; } -#define psyco_libpq_version_doc "Query actual libpq version loaded." +#define libpq_version_doc "Query actual libpq version loaded." static PyObject* -psyco_libpq_version(PyObject *self, PyObject *dummy) +libpq_version(PyObject *self, PyObject *dummy) { return PyInt_FromLong(PQlibVersion()); } /* encrypt_password - Prepare the encrypted password form */ -#define psyco_encrypt_password_doc \ +#define encrypt_password_doc \ "encrypt_password(password, user, [scope], [algorithm]) -- Prepares the encrypted form of a PostgreSQL password.\n\n" static PyObject * -psyco_encrypt_password(PyObject *self, PyObject *args, PyObject *kwargs) +encrypt_password(PyObject *self, PyObject *args, PyObject *kwargs) { char *encrypted = NULL; PyObject *password = NULL, *user = NULL; @@ -945,9 +945,9 @@ datetime_init(void) /* Initialize the PyDateTimeAPI everywhere is used */ PyDateTime_IMPORT; - if (0 > psyco_adapter_datetime_init()) { return -1; } - if (0 > psyco_repl_curs_datetime_init()) { return -1; } - if (0 > psyco_replmsg_datetime_init()) { return -1; } + if (0 > adapter_datetime_init()) { return -1; } + if (0 > repl_curs_datetime_init()) { return -1; } + if (0 > replmsg_datetime_init()) { return -1; } Py_TYPE(&pydatetimeType) = &PyType_Type; if (0 > PyType_Ready(&pydatetimeType)) { return -1; } @@ -986,23 +986,23 @@ mxdatetime_init(PyObject *module) /** method table and module initialization **/ static PyMethodDef psycopgMethods[] = { - {"_connect", (PyCFunction)psyco_connect, - METH_VARARGS|METH_KEYWORDS, psyco_connect_doc}, - {"parse_dsn", (PyCFunction)psyco_parse_dsn, - METH_VARARGS|METH_KEYWORDS, psyco_parse_dsn_doc}, - {"quote_ident", (PyCFunction)psyco_quote_ident, - METH_VARARGS|METH_KEYWORDS, psyco_quote_ident_doc}, + {"_connect", (PyCFunction)connect, + METH_VARARGS|METH_KEYWORDS, connect_doc}, + {"parse_dsn", (PyCFunction)parse_dsn, + METH_VARARGS|METH_KEYWORDS, parse_dsn_doc}, + {"quote_ident", (PyCFunction)quote_ident, + METH_VARARGS|METH_KEYWORDS, quote_ident_doc}, {"adapt", (PyCFunction)psyco_microprotocols_adapt, METH_VARARGS, psyco_microprotocols_adapt_doc}, - {"register_type", (PyCFunction)psyco_register_type, - METH_VARARGS, psyco_register_type_doc}, + {"register_type", (PyCFunction)register_type, + METH_VARARGS, register_type_doc}, {"new_type", (PyCFunction)typecast_from_python, METH_VARARGS|METH_KEYWORDS, typecast_from_python_doc}, {"new_array_type", (PyCFunction)typecast_array_from_python, METH_VARARGS|METH_KEYWORDS, typecast_array_from_python_doc}, - {"libpq_version", (PyCFunction)psyco_libpq_version, - METH_NOARGS, psyco_libpq_version_doc}, + {"libpq_version", (PyCFunction)libpq_version, + METH_NOARGS, libpq_version_doc}, {"Date", (PyCFunction)psyco_Date, METH_VARARGS, psyco_Date_doc}, @@ -1042,8 +1042,8 @@ static PyMethodDef psycopgMethods[] = { METH_O, psyco_set_wait_callback_doc}, {"get_wait_callback", (PyCFunction)psyco_get_wait_callback, METH_NOARGS, psyco_get_wait_callback_doc}, - {"encrypt_password", (PyCFunction)psyco_encrypt_password, - METH_VARARGS|METH_KEYWORDS, psyco_encrypt_password_doc}, + {"encrypt_password", (PyCFunction)encrypt_password, + METH_VARARGS|METH_KEYWORDS, encrypt_password_doc}, {NULL, NULL, 0, NULL} /* Sentinel */ }; @@ -1078,7 +1078,7 @@ INIT_MODULE(_psycopg)(void) Dprintf("psycopgmodule: initializing psycopg %s", xstr(PSYCOPG_VERSION)); /* initialize libcrypto threading callbacks */ - psyco_libcrypto_threads_init(); + libcrypto_threads_init(); /* initialize types and objects not exposed to the module */ Py_TYPE(&typecastType) = &PyType_Type; diff --git a/psycopg/replication_cursor.h b/psycopg/replication_cursor.h index 6a8de2ef..b07e49c5 100644 --- a/psycopg/replication_cursor.h +++ b/psycopg/replication_cursor.h @@ -50,7 +50,7 @@ typedef struct replicationCursorObject { } replicationCursorObject; -RAISES_NEG HIDDEN int psyco_repl_curs_datetime_init(void); +RAISES_NEG HIDDEN int repl_curs_datetime_init(void); #ifdef __cplusplus } diff --git a/psycopg/replication_cursor_type.c b/psycopg/replication_cursor_type.c index f3e829a4..678dc73c 100644 --- a/psycopg/replication_cursor_type.c +++ b/psycopg/replication_cursor_type.c @@ -38,11 +38,11 @@ #include "datetime.h" -#define psyco_repl_curs_start_replication_expert_doc \ +#define start_replication_expert_doc \ "start_replication_expert(command, decode=False) -- Start replication with a given command." static PyObject * -psyco_repl_curs_start_replication_expert(replicationCursorObject *self, +start_replication_expert(replicationCursorObject *self, PyObject *args, PyObject *kwargs) { cursorObject *curs = &self->cur; @@ -60,12 +60,11 @@ psyco_repl_curs_start_replication_expert(replicationCursorObject *self, EXC_IF_GREEN(start_replication_expert); EXC_IF_TPC_PREPARED(conn, start_replication_expert); - if (!(command = psyco_curs_validate_sql_basic( - (cursorObject *)self, command))) { + if (!(command = curs_validate_sql_basic((cursorObject *)self, command))) { goto exit; } - Dprintf("psyco_repl_curs_start_replication_expert: '%s'; decode: %ld", + Dprintf("start_replication_expert: '%s'; decode: %ld", Bytes_AS_STRING(command), decode); if (pq_execute(curs, Bytes_AS_STRING(command), conn->async, @@ -82,11 +81,11 @@ exit: return res; } -#define psyco_repl_curs_consume_stream_doc \ +#define consume_stream_doc \ "consume_stream(consumer, keepalive_interval=10) -- Consume replication stream." static PyObject * -psyco_repl_curs_consume_stream(replicationCursorObject *self, +consume_stream(replicationCursorObject *self, PyObject *args, PyObject *kwargs) { cursorObject *curs = &self->cur; @@ -104,7 +103,7 @@ psyco_repl_curs_consume_stream(replicationCursorObject *self, EXC_IF_GREEN(consume_stream); EXC_IF_TPC_PREPARED(self->cur.conn, consume_stream); - Dprintf("psyco_repl_curs_consume_stream"); + Dprintf("consume_stream"); if (keepalive_interval < 1.0) { psyco_set_error(ProgrammingError, curs, "keepalive_interval must be >= 1 (sec)"); @@ -136,11 +135,11 @@ psyco_repl_curs_consume_stream(replicationCursorObject *self, return res; } -#define psyco_repl_curs_read_message_doc \ +#define read_message_doc \ "read_message() -- Try reading a replication message from the server (non-blocking)." static PyObject * -psyco_repl_curs_read_message(replicationCursorObject *self, PyObject *dummy) +read_message(replicationCursorObject *self, PyObject *dummy) { cursorObject *curs = &self->cur; replicationMessageObject *msg = NULL; @@ -159,11 +158,11 @@ psyco_repl_curs_read_message(replicationCursorObject *self, PyObject *dummy) Py_RETURN_NONE; } -#define psyco_repl_curs_send_feedback_doc \ +#define send_feedback_doc \ "send_feedback(write_lsn=0, flush_lsn=0, apply_lsn=0, reply=False) -- Try sending a replication feedback message to the server and optionally request a reply." static PyObject * -psyco_repl_curs_send_feedback(replicationCursorObject *self, +send_feedback(replicationCursorObject *self, PyObject *args, PyObject *kwargs) { cursorObject *curs = &self->cur; @@ -196,7 +195,7 @@ psyco_repl_curs_send_feedback(replicationCursorObject *self, RAISES_NEG int -psyco_repl_curs_datetime_init(void) +repl_curs_datetime_init(void) { PyDateTime_IMPORT; @@ -207,11 +206,11 @@ psyco_repl_curs_datetime_init(void) return 0; } -#define psyco_repl_curs_io_timestamp_doc \ +#define repl_curs_io_timestamp_doc \ "io_timestamp -- the timestamp of latest IO with the server" static PyObject * -psyco_repl_curs_get_io_timestamp(replicationCursorObject *self) +repl_curs_get_io_timestamp(replicationCursorObject *self) { cursorObject *curs = &self->cur; PyObject *tval, *res = NULL; @@ -232,14 +231,14 @@ psyco_repl_curs_get_io_timestamp(replicationCursorObject *self) /* object method list */ static struct PyMethodDef replicationCursorObject_methods[] = { - {"start_replication_expert", (PyCFunction)psyco_repl_curs_start_replication_expert, - METH_VARARGS|METH_KEYWORDS, psyco_repl_curs_start_replication_expert_doc}, - {"consume_stream", (PyCFunction)psyco_repl_curs_consume_stream, - METH_VARARGS|METH_KEYWORDS, psyco_repl_curs_consume_stream_doc}, - {"read_message", (PyCFunction)psyco_repl_curs_read_message, - METH_NOARGS, psyco_repl_curs_read_message_doc}, - {"send_feedback", (PyCFunction)psyco_repl_curs_send_feedback, - METH_VARARGS|METH_KEYWORDS, psyco_repl_curs_send_feedback_doc}, + {"start_replication_expert", (PyCFunction)start_replication_expert, + METH_VARARGS|METH_KEYWORDS, start_replication_expert_doc}, + {"consume_stream", (PyCFunction)consume_stream, + METH_VARARGS|METH_KEYWORDS, consume_stream_doc}, + {"read_message", (PyCFunction)read_message, + METH_NOARGS, read_message_doc}, + {"send_feedback", (PyCFunction)send_feedback, + METH_VARARGS|METH_KEYWORDS, send_feedback_doc}, {NULL} }; @@ -247,8 +246,8 @@ static struct PyMethodDef replicationCursorObject_methods[] = { static struct PyGetSetDef replicationCursorObject_getsets[] = { { "io_timestamp", - (getter)psyco_repl_curs_get_io_timestamp, NULL, - psyco_repl_curs_io_timestamp_doc, NULL }, + (getter)repl_curs_get_io_timestamp, NULL, + repl_curs_io_timestamp_doc, NULL }, {NULL} }; diff --git a/psycopg/replication_message.h b/psycopg/replication_message.h index 8af3955f..710114a8 100644 --- a/psycopg/replication_message.h +++ b/psycopg/replication_message.h @@ -48,7 +48,7 @@ struct replicationMessageObject { int64_t send_time; }; -RAISES_NEG HIDDEN int psyco_replmsg_datetime_init(void); +RAISES_NEG HIDDEN int replmsg_datetime_init(void); #ifdef __cplusplus } diff --git a/psycopg/replication_message_type.c b/psycopg/replication_message_type.c index 248e9ec3..c18b6250 100644 --- a/psycopg/replication_message_type.c +++ b/psycopg/replication_message_type.c @@ -31,7 +31,7 @@ #include "datetime.h" RAISES_NEG int -psyco_replmsg_datetime_init(void) +replmsg_datetime_init(void) { PyDateTime_IMPORT; @@ -102,11 +102,11 @@ replmsg_dealloc(PyObject* obj) Py_TYPE(obj)->tp_free(obj); } -#define psyco_replmsg_send_time_doc \ +#define replmsg_send_time_doc \ "send_time - Timestamp of the replication message departure from the server." static PyObject * -psyco_replmsg_get_send_time(replicationMessageObject *self) +replmsg_get_send_time(replicationMessageObject *self) { PyObject *tval, *res = NULL; double t; @@ -142,8 +142,8 @@ static struct PyMemberDef replicationMessageObject_members[] = { }; static struct PyGetSetDef replicationMessageObject_getsets[] = { - { "send_time", (getter)psyco_replmsg_get_send_time, NULL, - psyco_replmsg_send_time_doc, NULL }, + { "send_time", (getter)replmsg_get_send_time, NULL, + replmsg_send_time_doc, NULL }, {NULL} }; diff --git a/psycopg/typecast.c b/psycopg/typecast.c index 9710663f..11ad5b63 100644 --- a/psycopg/typecast.c +++ b/psycopg/typecast.c @@ -291,7 +291,7 @@ typecast_init(PyObject *module) /* register the date/time typecasters with their original names */ #ifdef HAVE_MXDATETIME - if (0 == psyco_typecast_mxdatetime_init()) { + if (0 == typecast_mxdatetime_init()) { for (i = 0; typecast_mxdatetime[i].name != NULL; i++) { t = (typecastObject *)typecast_from_c(&(typecast_mxdatetime[i]), dict); if (t == NULL) { goto exit; } @@ -302,7 +302,7 @@ typecast_init(PyObject *module) } #endif - if (0 > psyco_typecast_datetime_init()) { goto exit; } + if (0 > typecast_datetime_init()) { goto exit; } for (i = 0; typecast_pydatetime[i].name != NULL; i++) { t = (typecastObject *)typecast_from_c(&(typecast_pydatetime[i]), dict); if (t == NULL) { goto exit; } diff --git a/psycopg/typecast_binary.c b/psycopg/typecast_binary.c index 16d91bc6..c3753917 100644 --- a/psycopg/typecast_binary.c +++ b/psycopg/typecast_binary.c @@ -132,9 +132,9 @@ PyTypeObject chunkType = { }; -static char *psycopg_parse_hex( +static char *parse_hex( const char *bufin, Py_ssize_t sizein, Py_ssize_t *sizeout); -static char *psycopg_parse_escape( +static char *parse_escape( const char *bufin, Py_ssize_t sizein, Py_ssize_t *sizeout); /* The function is not static and not hidden as we use ctypes to test it. */ @@ -154,7 +154,7 @@ typecast_BINARY_cast(const char *s, Py_ssize_t l, PyObject *curs) * So the only robust option is to parse it ourselves - luckily it's * an easy format. */ - if (NULL == (buffer = psycopg_parse_hex(s, l, &len))) { + if (NULL == (buffer = parse_hex(s, l, &len))) { goto exit; } } @@ -169,7 +169,7 @@ typecast_BINARY_cast(const char *s, Py_ssize_t l, PyObject *curs) * So we'll just have our better integrated parser, let's finish this * story. */ - if (NULL == (buffer = psycopg_parse_escape(s, l, &len))) { + if (NULL == (buffer = parse_escape(s, l, &len))) { goto exit; } } @@ -219,7 +219,7 @@ static const char hex_lut[128] = { * In case of error set an exception and return NULL. */ static char * -psycopg_parse_hex(const char *bufin, Py_ssize_t sizein, Py_ssize_t *sizeout) +parse_hex(const char *bufin, Py_ssize_t sizein, Py_ssize_t *sizeout) { char *ret = NULL; const char *bufend = bufin + sizein; @@ -269,7 +269,7 @@ exit: * In case of error set an exception and return NULL. */ static char * -psycopg_parse_escape(const char *bufin, Py_ssize_t sizein, Py_ssize_t *sizeout) +parse_escape(const char *bufin, Py_ssize_t sizein, Py_ssize_t *sizeout) { char *ret = NULL; const char *bufend = bufin + sizein; diff --git a/psycopg/typecast_datetime.c b/psycopg/typecast_datetime.c index a5b882e9..2fd96899 100644 --- a/psycopg/typecast_datetime.c +++ b/psycopg/typecast_datetime.c @@ -27,7 +27,7 @@ #include "datetime.h" RAISES_NEG static int -psyco_typecast_datetime_init(void) +typecast_datetime_init(void) { PyDateTime_IMPORT; diff --git a/psycopg/typecast_mxdatetime.c b/psycopg/typecast_mxdatetime.c index 1abeb40f..bee08071 100644 --- a/psycopg/typecast_mxdatetime.c +++ b/psycopg/typecast_mxdatetime.c @@ -29,10 +29,10 @@ /* Return 0 on success, -1 on failure, but don't set an exception */ static int -psyco_typecast_mxdatetime_init(void) +typecast_mxdatetime_init(void) { if (mxDateTime_ImportModuleAndAPI()) { - Dprintf("psyco_typecast_mxdatetime_init: mx.DateTime initialization failed"); + Dprintf("typecast_mxdatetime_init: mx.DateTime initialization failed"); PyErr_Clear(); return -1; }