Skip to content

Commit 4ea075c

Browse files
committed
Drop Python 2 support from input.c and uinput.c
1 parent dbb365d commit 4ea075c

File tree

2 files changed

+4
-45
lines changed

2 files changed

+4
-45
lines changed

src/evdev/input.c

+2-22
Original file line numberDiff line numberDiff line change
@@ -552,14 +552,10 @@ static PyMethodDef MethodTable[] = {
552552
};
553553

554554

555-
#define MODULE_NAME "_input"
556-
#define MODULE_HELP "Python bindings to certain linux input subsystem functions"
557-
558-
#if PY_MAJOR_VERSION >= 3
559555
static struct PyModuleDef moduledef = {
560556
PyModuleDef_HEAD_INIT,
561-
MODULE_NAME,
562-
MODULE_HELP,
557+
"_input",
558+
"Python bindings to certain linux input subsystem functions",
563559
-1, /* m_size */
564560
MethodTable, /* m_methods */
565561
NULL, /* m_reload */
@@ -581,19 +577,3 @@ PyInit__input(void)
581577
{
582578
return moduleinit();
583579
}
584-
585-
#else
586-
static PyObject *
587-
moduleinit(void)
588-
{
589-
PyObject* m = Py_InitModule3(MODULE_NAME, MethodTable, MODULE_HELP);
590-
if (m == NULL) return NULL;
591-
return m;
592-
}
593-
594-
PyMODINIT_FUNC
595-
init_input(void)
596-
{
597-
moduleinit();
598-
}
599-
#endif

src/evdev/uinput.c

+2-23
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,6 @@ int _uinput_end_erase(int fd, struct uinput_ff_erase *upload)
356356
return ioctl(fd, UI_END_FF_ERASE, upload);
357357
}
358358

359-
#define MODULE_NAME "_uinput"
360-
#define MODULE_HELP "Python bindings for parts of linux/uinput.c"
361359

362360
static PyMethodDef MethodTable[] = {
363361
{ "open", uinput_open, METH_VARARGS,
@@ -390,11 +388,10 @@ static PyMethodDef MethodTable[] = {
390388
{ NULL, NULL, 0, NULL}
391389
};
392390

393-
#if PY_MAJOR_VERSION >= 3
394391
static struct PyModuleDef moduledef = {
395392
PyModuleDef_HEAD_INIT,
396-
MODULE_NAME,
397-
MODULE_HELP,
393+
"_uinput",
394+
"Python bindings for parts of linux/uinput.c",
398395
-1, /* m_size */
399396
MethodTable, /* m_methods */
400397
NULL, /* m_reload */
@@ -418,21 +415,3 @@ PyInit__uinput(void)
418415
{
419416
return moduleinit();
420417
}
421-
422-
#else
423-
static PyObject *
424-
moduleinit(void)
425-
{
426-
PyObject* m = Py_InitModule3(MODULE_NAME, MethodTable, MODULE_HELP);
427-
if (m == NULL) return NULL;
428-
429-
PyModule_AddIntConstant(m, "maxnamelen", UINPUT_MAX_NAME_SIZE);
430-
return m;
431-
}
432-
433-
PyMODINIT_FUNC
434-
init_uinput(void)
435-
{
436-
moduleinit();
437-
}
438-
#endif

0 commit comments

Comments
 (0)