summaryrefslogtreecommitdiff
path: root/src/block_template.c
diff options
context:
space:
mode:
authorDwayne Litzenberger <dlitz@dlitz.net>2013-07-14 16:02:04 -0700
committerDwayne Litzenberger <dlitz@dlitz.net>2013-07-14 19:13:33 -0700
commit5c0ec3238a2b8f69be75040c706959e5c852f5ad (patch)
tree53d561098fb3d75af643333a0302e32fafd33d9c /src/block_template.c
parent1418e318180f651de1c4b08468b75ca719d703ba (diff)
downloadpycrypto-5c0ec3238a2b8f69be75040c706959e5c852f5ad.tar.gz
Py3k cleanup: Define PyInt_FromLong for Python 3.x and use it
This is the first of a series of changes that aims to reduce code duplication between the Python 3 and Python 2 versions of the C extensions.
Diffstat (limited to 'src/block_template.c')
-rw-r--r--src/block_template.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/block_template.c b/src/block_template.c
index e1f3f2f..0e7442a 100644
--- a/src/block_template.c
+++ b/src/block_template.c
@@ -75,7 +75,6 @@ static PyTypeObject ALGtype;
#else
staticforward PyTypeObject ALGtype;
#define is_ALGobject(v) ((v)->ob_type == &ALGtype)
-#define PyLong_FromLong PyInt_FromLong /* For Python 2.x */
#endif
static ALGobject *
@@ -668,7 +667,7 @@ ALGgetattr(PyObject *s, char *name)
if (strcmp(name, "mode") == 0)
#endif
{
- return(PyLong_FromLong((long)(self->mode)));
+ return(PyInt_FromLong((long)(self->mode)));
}
#ifdef IS_PY3K
if (PyUnicode_CompareWithASCIIString(attr, "block_size") == 0)
@@ -676,7 +675,7 @@ ALGgetattr(PyObject *s, char *name)
if (strcmp(name, "block_size") == 0)
#endif
{
- return PyLong_FromLong(BLOCK_SIZE);
+ return PyInt_FromLong(BLOCK_SIZE);
}
#ifdef IS_PY3K
if (PyUnicode_CompareWithASCIIString(attr, "key_size") == 0)
@@ -684,7 +683,7 @@ ALGgetattr(PyObject *s, char *name)
if (strcmp(name, "key_size") == 0)
#endif
{
- return PyLong_FromLong(KEY_SIZE);
+ return PyInt_FromLong(KEY_SIZE);
}
#ifdef IS_PY3K
generic: