diff options
Diffstat (limited to 'src/pycrypto_compat.h')
-rw-r--r-- | src/pycrypto_compat.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/pycrypto_compat.h b/src/pycrypto_compat.h index 6234839..ccaf21a 100644 --- a/src/pycrypto_compat.h +++ b/src/pycrypto_compat.h @@ -47,6 +47,18 @@ # endif #endif +/* Python 2.1 doesn't have PyModule_AddIntConstant */ +#if PYTHON_API_VERSION < 1011 +#define PyModule_AddIntConstant(m,n,v) \ + do { \ + PyObject *o=PyInt_FromLong(v); \ + if (o!=NULL) { \ + PyObject_SetAttrString((m),(n),o); \ + Py_DECREF(o); \ + } \ + } while(0) +#endif + /* * Py_CLEAR for Python < 2.4 * See http://docs.python.org/api/countingRefs.html |