Commit a45ebcac authored by Tres Seaver's avatar Tres Seaver

Try to fix a compilation error on 32-bit mode OS/X.

Fixes #2 (maybe).
parent 41c31f70
...@@ -99,11 +99,7 @@ longlong_check(PyObject *ob) ...@@ -99,11 +99,7 @@ longlong_check(PyObject *ob)
static PyObject * static PyObject *
longlong_as_object(PY_LONG_LONG val) longlong_as_object(PY_LONG_LONG val)
{ {
static PY_LONG_LONG maxint = 0; if ((val > LONG_MAX) || (val < LONG_MIN))
if (maxint == 0)
maxint = INT_GETMAX();
if ((val > maxint) || (val < (-maxint-1)))
return PyLong_FromLongLong(val); return PyLong_FromLongLong(val);
return INT_FROM_LONG((long)val); return INT_FROM_LONG((long)val);
} }
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#define INT_FROM_LONG(x) PyLong_FromLong(x) #define INT_FROM_LONG(x) PyLong_FromLong(x)
#define INT_CHECK(x) PyLong_Check(x) #define INT_CHECK(x) PyLong_Check(x)
#define INT_AS_LONG(x) PyLong_AS_LONG(x) #define INT_AS_LONG(x) PyLong_AS_LONG(x)
#define INT_GETMAX(x) 2<<31
#define TEXT_FROM_STRING PyUnicode_FromString #define TEXT_FROM_STRING PyUnicode_FromString
#define TEXT_FORMAT PyUnicode_Format #define TEXT_FORMAT PyUnicode_Format
...@@ -39,7 +38,6 @@ ...@@ -39,7 +38,6 @@
#define INT_FROM_LONG(x) PyInt_FromLong(x) #define INT_FROM_LONG(x) PyInt_FromLong(x)
#define INT_CHECK(x) PyInt_Check(x) #define INT_CHECK(x) PyInt_Check(x)
#define INT_AS_LONG(x) PyInt_AS_LONG(x) #define INT_AS_LONG(x) PyInt_AS_LONG(x)
#define INT_GETMAX(x) PyInt_GetMax(x)
#define TEXT_FROM_STRING PyString_FromString #define TEXT_FROM_STRING PyString_FromString
#define TEXT_FORMAT PyString_Format #define TEXT_FORMAT PyString_Format
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
4.0.7 (unreleased) 4.0.7 (unreleased)
------------------ ------------------
- Issue #2: compilation error on 32-bit mode of OS/X.
- Test ``PURE_PYTHON`` environment variable support: if set, the C - Test ``PURE_PYTHON`` environment variable support: if set, the C
extensions will not be built, imported, or tested. extensions will not be built, imported, or tested.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment