From 1b309c67633759a5449cbdb38d18f86c861b53c6 Mon Sep 17 00:00:00 2001 From: Dwayne Litzenberger Date: Sun, 14 Jul 2013 16:18:21 -0700 Subject: Py3k cleanup: METH_O --- src/block_template.c | 5 ----- src/pycrypto_compat.h | 3 +++ src/stream_template.c | 5 ----- 3 files changed, 3 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/block_template.c b/src/block_template.c index f12fbfb..b8a5a17 100644 --- a/src/block_template.c +++ b/src/block_template.c @@ -591,13 +591,8 @@ ALG_Decrypt(ALGobject *self, PyObject *args) /* ALG object methods */ static PyMethodDef ALGmethods[] = { -#ifdef IS_PY3K {"encrypt", (PyCFunction) ALG_Encrypt, METH_O, ALG_Encrypt__doc__}, {"decrypt", (PyCFunction) ALG_Decrypt, METH_O, ALG_Decrypt__doc__}, -#else - {"encrypt", (PyCFunction) ALG_Encrypt, 0, ALG_Encrypt__doc__}, - {"decrypt", (PyCFunction) ALG_Decrypt, 0, ALG_Decrypt__doc__}, -#endif {NULL, NULL} /* sentinel */ }; diff --git a/src/pycrypto_compat.h b/src/pycrypto_compat.h index ccaf21a..c9098d4 100644 --- a/src/pycrypto_compat.h +++ b/src/pycrypto_compat.h @@ -45,6 +45,9 @@ # define PyLong_SHIFT SHIFT # define PyUnicode_FromString PyString_FromString # endif +# if PY_MINOR_VERSION <= 1 /* Python 2.1 only */ +# define METH_O METH_OLDARGS /* METH_O is a subset of what METH_OLDARGS provides */ +# endif #endif /* Python 2.1 doesn't have PyModule_AddIntConstant */ diff --git a/src/stream_template.c b/src/stream_template.c index 9c5a99a..1e03f34 100644 --- a/src/stream_template.c +++ b/src/stream_template.c @@ -187,13 +187,8 @@ ALG_Decrypt(ALGobject *self, PyObject *args) /* ALGobject methods */ static PyMethodDef ALGmethods[] = { -#ifdef IS_PY3K {"encrypt", (PyCFunction) ALG_Encrypt, METH_O, ALG_Encrypt__doc__}, {"decrypt", (PyCFunction) ALG_Decrypt, METH_O, ALG_Decrypt__doc__}, -#else - {"encrypt", (PyCFunction) ALG_Encrypt, 0, ALG_Encrypt__doc__}, - {"decrypt", (PyCFunction) ALG_Decrypt, 0, ALG_Decrypt__doc__}, -#endif {NULL, NULL} /* sentinel */ }; -- cgit v1.2.1