summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDwayne Litzenberger <dlitz@dlitz.net>2013-07-14 16:28:12 -0700
committerDwayne Litzenberger <dlitz@dlitz.net>2013-07-14 19:14:35 -0700
commit52287434f824732c52ba21b771a9626c312ca4e9 (patch)
tree246277b4c7833000f68125c0e65bd85503074931 /src
parentab8fc54acaa511d224a9855f9cfc253e7d280547 (diff)
downloadpycrypto-52287434f824732c52ba21b771a9626c312ca4e9.tar.gz
Py3k cleanup: PyInt_CheckExact & PyInt_AS_LONG
Diffstat (limited to 'src')
-rw-r--r--src/block_template.c11
-rw-r--r--src/pycrypto_compat.h3
2 files changed, 3 insertions, 11 deletions
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