@@ -89,20 +89,9 @@ static PyObject* notify(PyObject *self, PyObject *args, PyObject *keywds) {
8989 "fds" ,
9090 NULL ,
9191 };
92- #if PY_MAJOR_VERSION >=3 && PY_MINOR_VERSION >= 3
9392 if (!PyArg_ParseTupleAndKeywords (args , keywds , "s|piO:notify" ,
9493 (char * * ) kwlist , & msg , & unset , & _pid , & fds ))
9594 return NULL ;
96- #else
97- PyObject * obj = NULL ;
98- if (!PyArg_ParseTupleAndKeywords (args , keywds , "s|OiO:notify" ,
99- (char * * ) kwlist , & msg , & obj , & _pid , & fds ))
100- return NULL ;
101- if (obj )
102- unset = PyObject_IsTrue (obj );
103- if (unset < 0 )
104- return NULL ;
105- #endif
10695 pid = _pid ;
10796 if (pid < 0 || pid != _pid ) {
10897 PyErr_SetString (PyExc_OverflowError , "Bad pid_t" );
@@ -176,20 +165,9 @@ static PyObject* listen_fds(PyObject *self, PyObject *args, PyObject *keywds) {
176165 int unset = true;
177166
178167 static const char * const kwlist [] = {"unset_environment" , NULL };
179- #if PY_MAJOR_VERSION >=3 && PY_MINOR_VERSION >= 3
180168 if (!PyArg_ParseTupleAndKeywords (args , keywds , "|p:_listen_fds" ,
181169 (char * * ) kwlist , & unset ))
182170 return NULL ;
183- #else
184- PyObject * obj = NULL ;
185- if (!PyArg_ParseTupleAndKeywords (args , keywds , "|O:_listen_fds" ,
186- (char * * ) kwlist , & obj ))
187- return NULL ;
188- if (obj )
189- unset = PyObject_IsTrue (obj );
190- if (unset < 0 )
191- return NULL ;
192- #endif
193171
194172 r = sd_listen_fds (unset );
195173 if (set_error (r , NULL , NULL ) < 0 )
@@ -223,20 +201,9 @@ static PyObject* listen_fds_with_names(PyObject *self, PyObject *args, PyObject
223201 PyObject * tpl , * item ;
224202
225203 static const char * const kwlist [] = {"unset_environment" , NULL };
226- #if PY_MAJOR_VERSION >=3 && PY_MINOR_VERSION >= 3
227204 if (!PyArg_ParseTupleAndKeywords (args , keywds , "|p:_listen_fds_with_names" ,
228205 (char * * ) kwlist , & unset ))
229206 return NULL ;
230- #else
231- PyObject * obj = NULL ;
232- if (!PyArg_ParseTupleAndKeywords (args , keywds , "|O:_listen_fds_with_names" ,
233- (char * * ) kwlist , & obj ))
234- return NULL ;
235- if (obj != NULL )
236- unset = PyObject_IsTrue (obj );
237- if (unset < 0 )
238- return NULL ;
239- #endif
240207
241208#if HAVE_SD_LISTEN_FDS_WITH_NAMES
242209 r = sd_listen_fds_with_names (unset , & names );
@@ -284,17 +251,12 @@ static PyObject* is_fifo(PyObject *self, PyObject *args) {
284251 int fd ;
285252 const char * path = NULL ;
286253
287- #if PY_MAJOR_VERSION >=3 && PY_MINOR_VERSION >= 1
288254 _cleanup_Py_DECREF_ PyObject * _path = NULL ;
289255 if (!PyArg_ParseTuple (args , "i|O&:_is_fifo" ,
290256 & fd , Unicode_FSConverter , & _path ))
291257 return NULL ;
292258 if (_path )
293259 path = PyBytes_AsString (_path );
294- #else
295- if (!PyArg_ParseTuple (args , "i|z:_is_fifo" , & fd , & path ))
296- return NULL ;
297- #endif
298260
299261 r = sd_is_fifo (fd , path );
300262 if (set_error (r , path , NULL ) < 0 )
@@ -315,17 +277,12 @@ static PyObject* is_mq(PyObject *self, PyObject *args) {
315277 int fd ;
316278 const char * path = NULL ;
317279
318- #if PY_MAJOR_VERSION >=3 && PY_MINOR_VERSION >= 1
319280 _cleanup_Py_DECREF_ PyObject * _path = NULL ;
320281 if (!PyArg_ParseTuple (args , "i|O&:_is_mq" ,
321282 & fd , Unicode_FSConverter , & _path ))
322283 return NULL ;
323284 if (_path )
324285 path = PyBytes_AsString (_path );
325- #else
326- if (!PyArg_ParseTuple (args , "i|z:_is_mq" , & fd , & path ))
327- return NULL ;
328- #endif
329286
330287 r = sd_is_mq (fd , path );
331288 if (set_error (r , path , NULL ) < 0 )
@@ -451,7 +408,6 @@ static PyObject* is_socket_unix(PyObject *self, PyObject *args) {
451408 char * path = NULL ;
452409 Py_ssize_t length = 0 ;
453410
454- #if PY_MAJOR_VERSION >=3 && PY_MINOR_VERSION >= 1
455411 _cleanup_Py_DECREF_ PyObject * _path = NULL ;
456412 if (!PyArg_ParseTuple (args , "i|iiO&:_is_socket_unix" ,
457413 & fd , & type , & listening , Unicode_FSConverter , & _path ))
@@ -461,11 +417,6 @@ static PyObject* is_socket_unix(PyObject *self, PyObject *args) {
461417 if (PyBytes_AsStringAndSize (_path , & path , & length ))
462418 return NULL ;
463419 }
464- #else
465- if (!PyArg_ParseTuple (args , "i|iiz#:_is_socket_unix" ,
466- & fd , & type , & listening , & path , & length ))
467- return NULL ;
468- #endif
469420
470421 r = sd_is_socket_unix (fd , type , listening , path , length );
471422 if (set_error (r , path , NULL ) < 0 )
@@ -490,23 +441,6 @@ static PyMethodDef methods[] = {
490441 {} /* Sentinel */
491442};
492443
493- #if PY_MAJOR_VERSION < 3
494-
495- DISABLE_WARNING_MISSING_PROTOTYPES ;
496- PyMODINIT_FUNC init_daemon (void ) {
497- PyObject * m ;
498-
499- m = Py_InitModule3 ("_daemon" , methods , module__doc__ );
500- if (!m )
501- return ;
502-
503- PyModule_AddIntConstant (m , "LISTEN_FDS_START" , SD_LISTEN_FDS_START );
504- PyModule_AddStringConstant (m , "__version__" , PACKAGE_VERSION );
505- }
506- REENABLE_WARNING ;
507-
508- #else
509-
510444static struct PyModuleDef module = {
511445 PyModuleDef_HEAD_INIT ,
512446 .m_name = "_daemon" , /* name of module */
@@ -532,5 +466,3 @@ PyMODINIT_FUNC PyInit__daemon(void) {
532466 return m ;
533467}
534468REENABLE_WARNING ;
535-
536- #endif
0 commit comments