summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Objects/longobject.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c
index 4bf89d9..b7836f7 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -355,10 +355,10 @@ PyLong_FromLongLong(ival)
/* In case the compiler is faking it. */
return PyLong_FromLong( (long)ival );
#else
- if( ival <= (LONG_LONG)LONG_MAX ) {
+ if ((LONG_LONG)LONG_MIN <= ival && ival <= (LONG_LONG)LONG_MAX) {
return PyLong_FromLong( (long)ival );
}
- else if( ival <= (unsigned LONG_LONG)ULONG_MAX ) {
+ else if (0 <= ival && ival <= (unsigned LONG_LONG)ULONG_MAX) {
return PyLong_FromUnsignedLong( (unsigned long)ival );
}
else {