@@ -35,8 +35,9 @@ PyDoc_STRVAR(booted__doc__,
3535 "Wraps sd_booted(3)."
3636);
3737
38- static PyObject * booted (PyObject * self , PyObject * args ) {
38+ static PyObject * booted (PyObject * self _unused_ , PyObject * args ) {
3939 int r ;
40+
4041 assert (!args );
4142
4243 r = sd_booted ();
@@ -55,7 +56,7 @@ PyDoc_STRVAR(notify__doc__,
5556 "Send a message to the init system about a status change.\n"
5657 "Wraps sd_notify(3)." );
5758
58- static PyObject * notify (PyObject * self , PyObject * args , PyObject * keywds ) {
59+ static PyObject * notify (PyObject * self _unused_ , PyObject * args , PyObject * keywds ) {
5960 int r ;
6061 const char * msg ;
6162 int unset = false, n_fds ;
@@ -142,7 +143,7 @@ PyDoc_STRVAR(listen_fds__doc__,
142143 "Wraps sd_listen_fds(3)."
143144);
144145
145- static PyObject * listen_fds (PyObject * self , PyObject * args , PyObject * keywds ) {
146+ static PyObject * listen_fds (PyObject * self _unused_ , PyObject * args , PyObject * keywds ) {
146147 int r ;
147148 int unset = true;
148149
@@ -155,7 +156,7 @@ static PyObject* listen_fds(PyObject *self, PyObject *args, PyObject *keywds) {
155156 if (set_error (r , NULL , NULL ) < 0 )
156157 return NULL ;
157158
158- return long_FromLong (r );
159+ return PyLong_FromLong (r );
159160}
160161
161162PyDoc_STRVAR (listen_fds_with_names__doc__ ,
@@ -176,7 +177,8 @@ static void free_names(char **names) {
176177 free (* n );
177178 free (names );
178179}
179- static PyObject * listen_fds_with_names (PyObject * self , PyObject * args , PyObject * keywds ) {
180+
181+ static PyObject * listen_fds_with_names (PyObject * self _unused_ , PyObject * args , PyObject * keywds ) {
180182 int r ;
181183 int unset = false;
182184 char * * names = NULL ;
@@ -196,7 +198,7 @@ static PyObject* listen_fds_with_names(PyObject *self, PyObject *args, PyObject
196198 if (tpl == NULL )
197199 return NULL ;
198200
199- item = long_FromLong (r );
201+ item = PyLong_FromLong (r );
200202 if (item == NULL ) {
201203 Py_DECREF (tpl );
202204 return NULL ;
@@ -206,7 +208,7 @@ static PyObject* listen_fds_with_names(PyObject *self, PyObject *args, PyObject
206208 return NULL ;
207209 }
208210 for (int i = 0 ; i < r && names [i ] != NULL ; i ++ ) {
209- item = unicode_FromString (names [i ]);
211+ item = PyUnicode_FromString (names [i ]);
210212 if (PyTuple_SetItem (tpl , 1 + i , item ) < 0 ) {
211213 Py_DECREF (tpl );
212214 free_names (names );
@@ -228,7 +230,7 @@ PyDoc_STRVAR(is_fifo__doc__,
228230);
229231
230232
231- static PyObject * is_fifo (PyObject * self , PyObject * args ) {
233+ static PyObject * is_fifo (PyObject * self _unused_ , PyObject * args ) {
232234 int r ;
233235 int fd ;
234236 const char * path = NULL ;
@@ -254,7 +256,7 @@ PyDoc_STRVAR(is_mq__doc__,
254256 "Wraps sd_is_mq(3)."
255257);
256258
257- static PyObject * is_mq (PyObject * self , PyObject * args ) {
259+ static PyObject * is_mq (PyObject * self _unused_ , PyObject * args ) {
258260 int r ;
259261 int fd ;
260262 const char * path = NULL ;
@@ -282,7 +284,7 @@ PyDoc_STRVAR(is_socket__doc__,
282284 "Constants for `family` are defined in the socket module."
283285);
284286
285- static PyObject * is_socket (PyObject * self , PyObject * args ) {
287+ static PyObject * is_socket (PyObject * self _unused_ , PyObject * args ) {
286288 int r ;
287289 int fd , family = AF_UNSPEC , type = 0 , listening = -1 ;
288290
@@ -304,7 +306,7 @@ PyDoc_STRVAR(is_socket_inet__doc__,
304306 "Constants for `family` are defined in the socket module."
305307);
306308
307- static PyObject * is_socket_inet (PyObject * self , PyObject * args ) {
309+ static PyObject * is_socket_inet (PyObject * self _unused_ , PyObject * args ) {
308310 int r ;
309311 int fd , family = AF_UNSPEC , type = 0 , listening = -1 , port = 0 ;
310312
@@ -337,7 +339,7 @@ PyDoc_STRVAR(is_socket_sockaddr__doc__,
337339#endif
338340);
339341
340- static PyObject * is_socket_sockaddr (PyObject * self , PyObject * args ) {
342+ static PyObject * is_socket_sockaddr (PyObject * self _unused_ , PyObject * args ) {
341343 int r ;
342344 int fd , type = 0 , flowinfo = 0 , listening = -1 ;
343345 const char * address ;
@@ -384,7 +386,7 @@ PyDoc_STRVAR(is_socket_unix__doc__,
384386 "Wraps sd_is_socket_unix(3)."
385387);
386388
387- static PyObject * is_socket_unix (PyObject * self , PyObject * args ) {
389+ static PyObject * is_socket_unix (PyObject * self _unused_ , PyObject * args ) {
388390 int r ;
389391 int fd , type = 0 , listening = -1 ;
390392 char * path = NULL ;
@@ -408,20 +410,22 @@ static PyObject* is_socket_unix(PyObject *self, PyObject *args) {
408410}
409411
410412
413+ DISABLE_WARNING_CAST_FUNCTION_TYPE ;
411414static PyMethodDef methods [] = {
412- { "booted" , booted , METH_NOARGS , booted__doc__ },
413- { "notify" , (PyCFunction ) notify , METH_VARARGS | METH_KEYWORDS , notify__doc__ },
414- { "_listen_fds" , (PyCFunction ) listen_fds , METH_VARARGS | METH_KEYWORDS , listen_fds__doc__ },
415+ { "booted" , booted , METH_NOARGS , booted__doc__ },
416+ { "notify" , (PyCFunction ) notify , METH_VARARGS | METH_KEYWORDS , notify__doc__ },
417+ { "_listen_fds" , (PyCFunction ) listen_fds , METH_VARARGS | METH_KEYWORDS , listen_fds__doc__ },
415418 { "_listen_fds_with_names" , (PyCFunction ) listen_fds_with_names ,
416- METH_VARARGS | METH_KEYWORDS , listen_fds_with_names__doc__ },
417- { "_is_fifo" , is_fifo , METH_VARARGS , is_fifo__doc__ },
418- { "_is_mq" , is_mq , METH_VARARGS , is_mq__doc__ },
419- { "_is_socket" , is_socket , METH_VARARGS , is_socket__doc__ },
420- { "_is_socket_inet" , is_socket_inet , METH_VARARGS , is_socket_inet__doc__ },
421- { "_is_socket_sockaddr" , is_socket_sockaddr , METH_VARARGS , is_socket_sockaddr__doc__ },
422- { "_is_socket_unix" , is_socket_unix , METH_VARARGS , is_socket_unix__doc__ },
419+ METH_VARARGS | METH_KEYWORDS , listen_fds_with_names__doc__ },
420+ { "_is_fifo" , is_fifo , METH_VARARGS , is_fifo__doc__ },
421+ { "_is_mq" , is_mq , METH_VARARGS , is_mq__doc__ },
422+ { "_is_socket" , is_socket , METH_VARARGS , is_socket__doc__ },
423+ { "_is_socket_inet" , is_socket_inet , METH_VARARGS , is_socket_inet__doc__ },
424+ { "_is_socket_sockaddr" , is_socket_sockaddr , METH_VARARGS , is_socket_sockaddr__doc__ },
425+ { "_is_socket_unix" , is_socket_unix , METH_VARARGS , is_socket_unix__doc__ },
423426 {} /* Sentinel */
424427};
428+ REENABLE_WARNING ;
425429
426430static struct PyModuleDef module = {
427431 PyModuleDef_HEAD_INIT ,
0 commit comments