diff options
author | Dwayne Litzenberger <dlitz@dlitz.net> | 2013-07-14 16:02:04 -0700 |
---|---|---|
committer | Dwayne Litzenberger <dlitz@dlitz.net> | 2013-07-14 19:13:33 -0700 |
commit | 5c0ec3238a2b8f69be75040c706959e5c852f5ad (patch) | |
tree | 53d561098fb3d75af643333a0302e32fafd33d9c /src/_counter.c | |
parent | 1418e318180f651de1c4b08468b75ca719d703ba (diff) | |
download | pycrypto-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/_counter.c')
-rw-r--r-- | src/_counter.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/_counter.c b/src/_counter.c index f82c378..2bd33ae 100644 --- a/src/_counter.c +++ b/src/_counter.c @@ -28,10 +28,6 @@ #include <string.h> #include "_counter.h" -#ifndef IS_PY3K -#define PyLong_FromLong PyInt_FromLong -#endif - /* Deal with old API in Python 2.1 */ #if PYTHON_API_VERSION < 1011 #define PyModule_AddIntConstant(m,n,v) {PyObject *o=PyInt_FromLong(v); \ @@ -166,7 +162,7 @@ _CounterObject_next_value(PCT_CounterObject *self, int little_endian) goto err_out; } - eight = PyLong_FromLong(8); + eight = PyInt_FromLong(8); if (!eight) goto err_out; @@ -191,7 +187,7 @@ _CounterObject_next_value(PCT_CounterObject *self, int little_endian) /* ch = ord(p) */ Py_CLEAR(ch); /* delete old ch */ - ch = PyLong_FromLong((long) *p); + ch = PyInt_FromLong((long) *p); if (!ch) goto err_out; @@ -326,7 +322,7 @@ CounterLEObject_getattr(PyObject *s, char *name) #else if (strcmp(name, "carry") == 0) { #endif - return PyLong_FromLong((long)self->carry); + return PyInt_FromLong((long)self->carry); } #ifdef IS_PY3K generic: @@ -352,7 +348,7 @@ CounterBEObject_getattr(PyObject *s, char *name) #else if (strcmp(name, "carry") == 0) { #endif - return PyLong_FromLong((long)self->carry); + return PyInt_FromLong((long)self->carry); } #ifdef IS_PY3K generic: |