mirror of
				https://github.com/psycopg/psycopg2.git
				synced 2025-11-01 00:07:36 +03:00 
			
		
		
		
	Respect PyCFunction signature in METH_NOARGS functions
A second parameter does exist, although it's always NULL.
This commit is contained in:
		
							parent
							
								
									5b08dc45b1
								
							
						
					
					
						commit
						3e66022912
					
				|  | @ -248,7 +248,7 @@ static PySequenceMethods column_sequence = { | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| static PyObject * | static PyObject * | ||||||
| column_getstate(columnObject *self) | column_getstate(columnObject *self, PyObject *dummy) | ||||||
| { | { | ||||||
|     return PyObject_CallFunctionObjArgs( |     return PyObject_CallFunctionObjArgs( | ||||||
|         (PyObject *)&PyTuple_Type, (PyObject *)self, NULL); |         (PyObject *)&PyTuple_Type, (PyObject *)self, NULL); | ||||||
|  |  | ||||||
|  | @ -138,7 +138,7 @@ exit: | ||||||
| #define psyco_conn_close_doc "close() -- Close the connection." | #define psyco_conn_close_doc "close() -- Close the connection." | ||||||
| 
 | 
 | ||||||
| static PyObject * | static PyObject * | ||||||
| psyco_conn_close(connectionObject *self) | psyco_conn_close(connectionObject *self, PyObject *dummy) | ||||||
| { | { | ||||||
|     Dprintf("psyco_conn_close: closing connection at %p", self); |     Dprintf("psyco_conn_close: closing connection at %p", self); | ||||||
|     conn_close(self); |     conn_close(self); | ||||||
|  | @ -153,7 +153,7 @@ psyco_conn_close(connectionObject *self) | ||||||
| #define psyco_conn_commit_doc "commit() -- Commit all changes to database." | #define psyco_conn_commit_doc "commit() -- Commit all changes to database." | ||||||
| 
 | 
 | ||||||
| static PyObject * | static PyObject * | ||||||
| psyco_conn_commit(connectionObject *self) | psyco_conn_commit(connectionObject *self, PyObject *dummy) | ||||||
| { | { | ||||||
|     EXC_IF_CONN_CLOSED(self); |     EXC_IF_CONN_CLOSED(self); | ||||||
|     EXC_IF_CONN_ASYNC(self, commit); |     EXC_IF_CONN_ASYNC(self, commit); | ||||||
|  | @ -172,7 +172,7 @@ psyco_conn_commit(connectionObject *self) | ||||||
| "rollback() -- Roll back all changes done to database." | "rollback() -- Roll back all changes done to database." | ||||||
| 
 | 
 | ||||||
| static PyObject * | static PyObject * | ||||||
| psyco_conn_rollback(connectionObject *self) | psyco_conn_rollback(connectionObject *self, PyObject *dummy) | ||||||
| { | { | ||||||
|     EXC_IF_CONN_CLOSED(self); |     EXC_IF_CONN_CLOSED(self); | ||||||
|     EXC_IF_CONN_ASYNC(self, rollback); |     EXC_IF_CONN_ASYNC(self, rollback); | ||||||
|  | @ -245,7 +245,7 @@ exit: | ||||||
| "tpc_prepare() -- perform the first phase of a two-phase transaction." | "tpc_prepare() -- perform the first phase of a two-phase transaction." | ||||||
| 
 | 
 | ||||||
| static PyObject * | static PyObject * | ||||||
| psyco_conn_tpc_prepare(connectionObject *self) | psyco_conn_tpc_prepare(connectionObject *self, PyObject *dummy) | ||||||
| { | { | ||||||
|     EXC_IF_CONN_CLOSED(self); |     EXC_IF_CONN_CLOSED(self); | ||||||
|     EXC_IF_CONN_ASYNC(self, tpc_prepare); |     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." | "tpc_recover() -- returns a list of pending transaction IDs." | ||||||
| 
 | 
 | ||||||
| static PyObject * | static PyObject * | ||||||
| psyco_conn_tpc_recover(connectionObject *self) | psyco_conn_tpc_recover(connectionObject *self, PyObject *dummy) | ||||||
| { | { | ||||||
|     EXC_IF_CONN_CLOSED(self); |     EXC_IF_CONN_CLOSED(self); | ||||||
|     EXC_IF_CONN_ASYNC(self, tpc_recover); |     EXC_IF_CONN_ASYNC(self, tpc_recover); | ||||||
|  | @ -403,7 +403,7 @@ psyco_conn_tpc_recover(connectionObject *self) | ||||||
| "__enter__ -> self" | "__enter__ -> self" | ||||||
| 
 | 
 | ||||||
| static PyObject * | static PyObject * | ||||||
| psyco_conn_enter(connectionObject *self) | psyco_conn_enter(connectionObject *self, PyObject *dummy) | ||||||
| { | { | ||||||
|     EXC_IF_CONN_CLOSED(self); |     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." | "get_native_connection() -- Return the internal PGconn* as a Python Capsule." | ||||||
| 
 | 
 | ||||||
| static PyObject * | static PyObject * | ||||||
| psyco_get_native_connection(connectionObject *self) | psyco_get_native_connection(connectionObject *self, PyObject *dummy) | ||||||
| { | { | ||||||
|     EXC_IF_CONN_CLOSED(self); |     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." | "get_transaction_status() -- Get backend transaction status." | ||||||
| 
 | 
 | ||||||
| static PyObject * | 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)); |     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" | "get_dsn_parameters() -- Get effective connection parameters.\n\n" | ||||||
| 
 | 
 | ||||||
| static PyObject * | static PyObject * | ||||||
| psyco_conn_get_dsn_parameters(connectionObject *self) | psyco_conn_get_dsn_parameters(connectionObject *self, PyObject *dummy) | ||||||
| { | { | ||||||
| #if PG_VERSION_NUM >= 90300 | #if PG_VERSION_NUM >= 90300 | ||||||
|     PyObject *res = NULL; |     PyObject *res = NULL; | ||||||
|  | @ -998,7 +998,7 @@ psyco_conn_lobject(connectionObject *self, PyObject *args, PyObject *keywds) | ||||||
| "get_backend_pid() -- Get backend process id." | "get_backend_pid() -- Get backend process id." | ||||||
| 
 | 
 | ||||||
| static PyObject * | static PyObject * | ||||||
| psyco_conn_get_backend_pid(connectionObject *self) | psyco_conn_get_backend_pid(connectionObject *self, PyObject *dummy) | ||||||
| { | { | ||||||
|     EXC_IF_CONN_CLOSED(self); |     EXC_IF_CONN_CLOSED(self); | ||||||
| 
 | 
 | ||||||
|  | @ -1025,7 +1025,7 @@ psyco_conn_info_get(connectionObject *self) | ||||||
| "reset() -- Reset current connection to defaults." | "reset() -- Reset current connection to defaults." | ||||||
| 
 | 
 | ||||||
| static PyObject * | static PyObject * | ||||||
| psyco_conn_reset(connectionObject *self) | psyco_conn_reset(connectionObject *self, PyObject *dummy) | ||||||
| { | { | ||||||
|     int res; |     int res; | ||||||
| 
 | 
 | ||||||
|  | @ -1056,7 +1056,7 @@ psyco_conn_get_exception(PyObject *self, void *closure) | ||||||
| "poll() -> int -- Advance the connection or query process without blocking." | "poll() -> int -- Advance the connection or query process without blocking." | ||||||
| 
 | 
 | ||||||
| static PyObject * | static PyObject * | ||||||
| psyco_conn_poll(connectionObject *self) | psyco_conn_poll(connectionObject *self, PyObject *dummy) | ||||||
| { | { | ||||||
|     int res; |     int res; | ||||||
| 
 | 
 | ||||||
|  | @ -1076,7 +1076,7 @@ psyco_conn_poll(connectionObject *self) | ||||||
| "fileno() -> int -- Return file descriptor associated to database connection." | "fileno() -> int -- Return file descriptor associated to database connection." | ||||||
| 
 | 
 | ||||||
| static PyObject * | static PyObject * | ||||||
| psyco_conn_fileno(connectionObject *self) | psyco_conn_fileno(connectionObject *self, PyObject *dummy) | ||||||
| { | { | ||||||
|     long int socket; |     long int socket; | ||||||
| 
 | 
 | ||||||
|  | @ -1093,7 +1093,7 @@ psyco_conn_fileno(connectionObject *self) | ||||||
|  "executing an asynchronous operation." |  "executing an asynchronous operation." | ||||||
| 
 | 
 | ||||||
| static PyObject * | static PyObject * | ||||||
| psyco_conn_isexecuting(connectionObject *self) | psyco_conn_isexecuting(connectionObject *self, PyObject *dummy) | ||||||
| { | { | ||||||
|     /* synchronous connections will always return False */ |     /* synchronous connections will always return False */ | ||||||
|     if (self->async == 0) { |     if (self->async == 0) { | ||||||
|  | @ -1119,7 +1119,7 @@ psyco_conn_isexecuting(connectionObject *self) | ||||||
| "cancel() -- cancel the current operation" | "cancel() -- cancel the current operation" | ||||||
| 
 | 
 | ||||||
| static PyObject * | static PyObject * | ||||||
| psyco_conn_cancel(connectionObject *self) | psyco_conn_cancel(connectionObject *self, PyObject *dummy) | ||||||
| { | { | ||||||
|     char errbuf[256]; |     char errbuf[256]; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -47,7 +47,7 @@ | ||||||
| "close() -- Close the cursor." | "close() -- Close the cursor." | ||||||
| 
 | 
 | ||||||
| static PyObject * | static PyObject * | ||||||
| psyco_curs_close(cursorObject *self) | psyco_curs_close(cursorObject *self, PyObject *dummy) | ||||||
| { | { | ||||||
|     PyObject *rv = NULL; |     PyObject *rv = NULL; | ||||||
|     char *lname = NULL; |     char *lname = NULL; | ||||||
|  | @ -756,7 +756,7 @@ exit: | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static PyObject * | static PyObject * | ||||||
| psyco_curs_fetchone(cursorObject *self) | psyco_curs_fetchone(cursorObject *self, PyObject *dummy) | ||||||
| { | { | ||||||
|     PyObject *res; |     PyObject *res; | ||||||
| 
 | 
 | ||||||
|  | @ -947,7 +947,7 @@ exit: | ||||||
| "Return `!None` when no more data is available.\n" | "Return `!None` when no more data is available.\n" | ||||||
| 
 | 
 | ||||||
| static PyObject * | static PyObject * | ||||||
| psyco_curs_fetchall(cursorObject *self) | psyco_curs_fetchall(cursorObject *self, PyObject *dummy) | ||||||
| { | { | ||||||
|     int i, size; |     int i, size; | ||||||
|     PyObject *list = NULL; |     PyObject *list = NULL; | ||||||
|  | @ -1162,7 +1162,7 @@ exit: | ||||||
| "sets) and will raise a NotSupportedError exception." | "sets) and will raise a NotSupportedError exception." | ||||||
| 
 | 
 | ||||||
| static PyObject * | static PyObject * | ||||||
| psyco_curs_nextset(cursorObject *self) | psyco_curs_nextset(cursorObject *self, PyObject *dummy) | ||||||
| { | { | ||||||
|     EXC_IF_CURS_CLOSED(self); |     EXC_IF_CURS_CLOSED(self); | ||||||
| 
 | 
 | ||||||
|  | @ -1279,7 +1279,7 @@ psyco_curs_scroll(cursorObject *self, PyObject *args, PyObject *kwargs) | ||||||
| "__enter__ -> self" | "__enter__ -> self" | ||||||
| 
 | 
 | ||||||
| static PyObject * | static PyObject * | ||||||
| psyco_curs_enter(cursorObject *self) | psyco_curs_enter(cursorObject *self, PyObject *dummy) | ||||||
| { | { | ||||||
|     Py_INCREF(self); |     Py_INCREF(self); | ||||||
|     return (PyObject *)self; |     return (PyObject *)self; | ||||||
|  | @ -1768,7 +1768,7 @@ cursor_next(PyObject *self) | ||||||
| 
 | 
 | ||||||
|     if (NULL == ((cursorObject*)self)->name) { |     if (NULL == ((cursorObject*)self)->name) { | ||||||
|         /* we don't parse arguments: psyco_curs_fetchone will do that for us */ |         /* 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 */ |         /* convert a None to NULL to signal the end of iteration */ | ||||||
|         if (res && res == Py_None) { |         if (res && res == Py_None) { | ||||||
|  |  | ||||||
|  | @ -131,7 +131,7 @@ static struct PyGetSetDef error_getsets[] = { | ||||||
|  * would require implementing __getstate__, and as of 2012 it's a little |  * would require implementing __getstate__, and as of 2012 it's a little | ||||||
|  * bit too late to care. */ |  * bit too late to care. */ | ||||||
| static PyObject * | static PyObject * | ||||||
| psyco_error_reduce(errorObject *self) | psyco_error_reduce(errorObject *self, PyObject *dummy) | ||||||
| { | { | ||||||
|     PyObject *meth = NULL; |     PyObject *meth = NULL; | ||||||
|     PyObject *tuple = NULL; |     PyObject *tuple = NULL; | ||||||
|  |  | ||||||
|  | @ -396,7 +396,7 @@ exit: | ||||||
| #define psyco_libpq_version_doc "Query actual libpq version loaded." | #define psyco_libpq_version_doc "Query actual libpq version loaded." | ||||||
| 
 | 
 | ||||||
| static PyObject* | static PyObject* | ||||||
| psyco_libpq_version(PyObject *self) | psyco_libpq_version(PyObject *self, PyObject *dummy) | ||||||
| { | { | ||||||
|     return PyInt_FromLong(PQlibVersion()); |     return PyInt_FromLong(PQlibVersion()); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -140,7 +140,7 @@ psyco_repl_curs_consume_stream(replicationCursorObject *self, | ||||||
| "read_message() -- Try reading a replication message from the server (non-blocking)." | "read_message() -- Try reading a replication message from the server (non-blocking)." | ||||||
| 
 | 
 | ||||||
| static PyObject * | static PyObject * | ||||||
| psyco_repl_curs_read_message(replicationCursorObject *self) | psyco_repl_curs_read_message(replicationCursorObject *self, PyObject *dummy) | ||||||
| { | { | ||||||
|     cursorObject *curs = &self->cur; |     cursorObject *curs = &self->cur; | ||||||
|     replicationMessageObject *msg = NULL; |     replicationMessageObject *msg = NULL; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user