Respect PyCFunction signature in METH_NOARGS functions

A second parameter does exist, although it's always NULL.
This commit is contained in:
Daniele Varrazzo 2018-12-27 23:31:58 +01:00
parent 5b08dc45b1
commit 3e66022912
6 changed files with 25 additions and 25 deletions

View File

@ -248,7 +248,7 @@ static PySequenceMethods column_sequence = {
static PyObject *
column_getstate(columnObject *self)
column_getstate(columnObject *self, PyObject *dummy)
{
return PyObject_CallFunctionObjArgs(
(PyObject *)&PyTuple_Type, (PyObject *)self, NULL);

View File

@ -138,7 +138,7 @@ exit:
#define psyco_conn_close_doc "close() -- Close the connection."
static PyObject *
psyco_conn_close(connectionObject *self)
psyco_conn_close(connectionObject *self, PyObject *dummy)
{
Dprintf("psyco_conn_close: closing connection at %p", self);
conn_close(self);
@ -153,7 +153,7 @@ psyco_conn_close(connectionObject *self)
#define psyco_conn_commit_doc "commit() -- Commit all changes to database."
static PyObject *
psyco_conn_commit(connectionObject *self)
psyco_conn_commit(connectionObject *self, PyObject *dummy)
{
EXC_IF_CONN_CLOSED(self);
EXC_IF_CONN_ASYNC(self, commit);
@ -172,7 +172,7 @@ psyco_conn_commit(connectionObject *self)
"rollback() -- Roll back all changes done to database."
static PyObject *
psyco_conn_rollback(connectionObject *self)
psyco_conn_rollback(connectionObject *self, PyObject *dummy)
{
EXC_IF_CONN_CLOSED(self);
EXC_IF_CONN_ASYNC(self, rollback);
@ -245,7 +245,7 @@ exit:
"tpc_prepare() -- perform the first phase of a two-phase transaction."
static PyObject *
psyco_conn_tpc_prepare(connectionObject *self)
psyco_conn_tpc_prepare(connectionObject *self, PyObject *dummy)
{
EXC_IF_CONN_CLOSED(self);
EXC_IF_CONN_ASYNC(self, tpc_prepare);
@ -388,7 +388,7 @@ psyco_conn_tpc_rollback(connectionObject *self, PyObject *args)
"tpc_recover() -- returns a list of pending transaction IDs."
static PyObject *
psyco_conn_tpc_recover(connectionObject *self)
psyco_conn_tpc_recover(connectionObject *self, PyObject *dummy)
{
EXC_IF_CONN_CLOSED(self);
EXC_IF_CONN_ASYNC(self, tpc_recover);
@ -403,7 +403,7 @@ psyco_conn_tpc_recover(connectionObject *self)
"__enter__ -> self"
static PyObject *
psyco_conn_enter(connectionObject *self)
psyco_conn_enter(connectionObject *self, PyObject *dummy)
{
EXC_IF_CONN_CLOSED(self);
@ -828,7 +828,7 @@ psyco_conn_deferrable_set(connectionObject *self, PyObject *pyvalue)
"get_native_connection() -- Return the internal PGconn* as a Python Capsule."
static PyObject *
psyco_get_native_connection(connectionObject *self)
psyco_get_native_connection(connectionObject *self, PyObject *dummy)
{
EXC_IF_CONN_CLOSED(self);
@ -866,7 +866,7 @@ psyco_conn_set_client_encoding(connectionObject *self, PyObject *args)
"get_transaction_status() -- Get backend transaction status."
static PyObject *
psyco_conn_get_transaction_status(connectionObject *self)
psyco_conn_get_transaction_status(connectionObject *self, PyObject *dummy)
{
return PyInt_FromLong((long)PQtransactionStatus(self->pgconn));
}
@ -905,7 +905,7 @@ psyco_conn_get_parameter_status(connectionObject *self, PyObject *args)
"get_dsn_parameters() -- Get effective connection parameters.\n\n"
static PyObject *
psyco_conn_get_dsn_parameters(connectionObject *self)
psyco_conn_get_dsn_parameters(connectionObject *self, PyObject *dummy)
{
#if PG_VERSION_NUM >= 90300
PyObject *res = NULL;
@ -998,7 +998,7 @@ psyco_conn_lobject(connectionObject *self, PyObject *args, PyObject *keywds)
"get_backend_pid() -- Get backend process id."
static PyObject *
psyco_conn_get_backend_pid(connectionObject *self)
psyco_conn_get_backend_pid(connectionObject *self, PyObject *dummy)
{
EXC_IF_CONN_CLOSED(self);
@ -1025,7 +1025,7 @@ psyco_conn_info_get(connectionObject *self)
"reset() -- Reset current connection to defaults."
static PyObject *
psyco_conn_reset(connectionObject *self)
psyco_conn_reset(connectionObject *self, PyObject *dummy)
{
int res;
@ -1056,7 +1056,7 @@ psyco_conn_get_exception(PyObject *self, void *closure)
"poll() -> int -- Advance the connection or query process without blocking."
static PyObject *
psyco_conn_poll(connectionObject *self)
psyco_conn_poll(connectionObject *self, PyObject *dummy)
{
int res;
@ -1076,7 +1076,7 @@ psyco_conn_poll(connectionObject *self)
"fileno() -> int -- Return file descriptor associated to database connection."
static PyObject *
psyco_conn_fileno(connectionObject *self)
psyco_conn_fileno(connectionObject *self, PyObject *dummy)
{
long int socket;
@ -1093,7 +1093,7 @@ psyco_conn_fileno(connectionObject *self)
"executing an asynchronous operation."
static PyObject *
psyco_conn_isexecuting(connectionObject *self)
psyco_conn_isexecuting(connectionObject *self, PyObject *dummy)
{
/* synchronous connections will always return False */
if (self->async == 0) {
@ -1119,7 +1119,7 @@ psyco_conn_isexecuting(connectionObject *self)
"cancel() -- cancel the current operation"
static PyObject *
psyco_conn_cancel(connectionObject *self)
psyco_conn_cancel(connectionObject *self, PyObject *dummy)
{
char errbuf[256];

View File

@ -47,7 +47,7 @@
"close() -- Close the cursor."
static PyObject *
psyco_curs_close(cursorObject *self)
psyco_curs_close(cursorObject *self, PyObject *dummy)
{
PyObject *rv = NULL;
char *lname = NULL;
@ -756,7 +756,7 @@ exit:
}
static PyObject *
psyco_curs_fetchone(cursorObject *self)
psyco_curs_fetchone(cursorObject *self, PyObject *dummy)
{
PyObject *res;
@ -947,7 +947,7 @@ exit:
"Return `!None` when no more data is available.\n"
static PyObject *
psyco_curs_fetchall(cursorObject *self)
psyco_curs_fetchall(cursorObject *self, PyObject *dummy)
{
int i, size;
PyObject *list = NULL;
@ -1162,7 +1162,7 @@ exit:
"sets) and will raise a NotSupportedError exception."
static PyObject *
psyco_curs_nextset(cursorObject *self)
psyco_curs_nextset(cursorObject *self, PyObject *dummy)
{
EXC_IF_CURS_CLOSED(self);
@ -1279,7 +1279,7 @@ psyco_curs_scroll(cursorObject *self, PyObject *args, PyObject *kwargs)
"__enter__ -> self"
static PyObject *
psyco_curs_enter(cursorObject *self)
psyco_curs_enter(cursorObject *self, PyObject *dummy)
{
Py_INCREF(self);
return (PyObject *)self;
@ -1768,7 +1768,7 @@ cursor_next(PyObject *self)
if (NULL == ((cursorObject*)self)->name) {
/* we don't parse arguments: psyco_curs_fetchone will do that for us */
res = psyco_curs_fetchone((cursorObject*)self);
res = psyco_curs_fetchone((cursorObject*)self, NULL);
/* convert a None to NULL to signal the end of iteration */
if (res && res == Py_None) {

View File

@ -131,7 +131,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)
psyco_error_reduce(errorObject *self, PyObject *dummy)
{
PyObject *meth = NULL;
PyObject *tuple = NULL;

View File

@ -396,7 +396,7 @@ exit:
#define psyco_libpq_version_doc "Query actual libpq version loaded."
static PyObject*
psyco_libpq_version(PyObject *self)
psyco_libpq_version(PyObject *self, PyObject *dummy)
{
return PyInt_FromLong(PQlibVersion());
}

View File

@ -140,7 +140,7 @@ psyco_repl_curs_consume_stream(replicationCursorObject *self,
"read_message() -- Try reading a replication message from the server (non-blocking)."
static PyObject *
psyco_repl_curs_read_message(replicationCursorObject *self)
psyco_repl_curs_read_message(replicationCursorObject *self, PyObject *dummy)
{
cursorObject *curs = &self->cur;
replicationMessageObject *msg = NULL;