From 52287434f824732c52ba21b771a9626c312ca4e9 Mon Sep 17 00:00:00 2001 From: Dwayne Litzenberger Date: Sun, 14 Jul 2013 16:28:12 -0700 Subject: Py3k cleanup: PyInt_CheckExact & PyInt_AS_LONG --- src/block_template.c | 11 ----------- src/pycrypto_compat.h | 3 +++ 2 files changed, 3 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/block_template.c b/src/block_template.c index 869df41..c2c711f 100644 --- a/src/block_template.c +++ b/src/block_template.c @@ -67,10 +67,6 @@ typedef struct /* Please see PEP3123 for a discussion of PyObject_HEAD and changes made in 3.x to make it conform to Standard C. * These changes also dictate using Py_TYPE to check type, and PyVarObject_HEAD_INIT(NULL, 0) to initialize */ -#ifdef IS_PY3K -#define PyInt_CheckExact PyLong_CheckExact -#define PyInt_AS_LONG PyLong_AS_LONG -#endif staticforward PyTypeObject ALGtype; static ALGobject * @@ -751,13 +747,6 @@ static struct PyModuleDef moduledef = { #endif /* Initialization function for the module */ - -/* Deal with old API in Python 2.1 */ -#if PYTHON_API_VERSION < 1011 -#define PyInt_CheckExact PyInt_Check -#endif - - #ifdef IS_PY3K PyMODINIT_FUNC #else diff --git a/src/pycrypto_compat.h b/src/pycrypto_compat.h index 3e8f92d..4f75273 100644 --- a/src/pycrypto_compat.h +++ b/src/pycrypto_compat.h @@ -31,6 +31,8 @@ #if PY_MAJOR_VERSION >= 3 # define IS_PY3K +# define PyInt_AS_LONG PyLong_AS_LONG +# define PyInt_CheckExact PyLong_CheckExact # define PyInt_FromLong PyLong_FromLong # define staticforward static #else @@ -49,6 +51,7 @@ # 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 */ +# define PyInt_CheckExact PyInt_Check # endif #endif -- cgit v1.2.1