summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-05-08 18:18:48 +0300
committerSerhiy Storchaka <storchaka@gmail.com>2017-05-08 18:18:48 +0300
commitb715bfee8f04d7b46fba62ec9d9ab95fe1a61ffd (patch)
tree1bfa9feced89238e4c1cfa6cad01f098ea33e6dc
parentf1a06fc7598f324acee332b02b6ecc43773b7b5d (diff)
downloadsimplejson-no-py2.4.tar.gz
Remofe remnants of Python 2.4 support.no-py2.4
Clean up the code by removing workarounds for supporting Python 2.4.
-rw-r--r--simplejson/_speedups.c13
-rw-r--r--simplejson/decoder.py6
-rw-r--r--simplejson/ordered_dict.py18
3 files changed, 2 insertions, 35 deletions
diff --git a/simplejson/_speedups.c b/simplejson/_speedups.c
index 2d81063..1c39a50 100644
--- a/simplejson/_speedups.c
+++ b/simplejson/_speedups.c
@@ -68,19 +68,6 @@ json_PyOS_string_to_double(const char *s, char **endptr, PyObject *overflow_exce
#endif
#endif /* PY_VERSION_HEX < 0x02060000 */
-#if PY_VERSION_HEX < 0x02050000
-#if !defined(PY_SSIZE_T_MIN)
-typedef int Py_ssize_t;
-#define PY_SSIZE_T_MAX INT_MAX
-#define PY_SSIZE_T_MIN INT_MIN
-#define PyInt_FromSsize_t PyInt_FromLong
-#define PyInt_AsSsize_t PyInt_AsLong
-#endif
-#if !defined(Py_IS_FINITE)
-#define Py_IS_FINITE(X) (!Py_IS_INFINITY(X) && !Py_IS_NAN(X))
-#endif
-#endif /* PY_VERSION_HEX < 0x02050000 */
-
#ifdef __GNUC__
#define UNUSED __attribute__((__unused__))
#else
diff --git a/simplejson/decoder.py b/simplejson/decoder.py
index 29de124..48f46c9 100644
--- a/simplejson/decoder.py
+++ b/simplejson/decoder.py
@@ -24,11 +24,7 @@ FLAGS = re.VERBOSE | re.MULTILINE | re.DOTALL
def _floatconstants():
if sys.version_info < (2, 6):
_BYTES = '7FF80000000000007FF0000000000000'.decode('hex')
- # The struct module in Python 2.4 would get frexp() out of range here
- # when an endian is specified in the format string. Fixed in Python 2.5+
- if sys.byteorder != 'big':
- _BYTES = _BYTES[:8][::-1] + _BYTES[8:][::-1]
- nan, inf = struct.unpack('dd', _BYTES)
+ nan, inf = struct.unpack('>dd', _BYTES)
else:
nan = float('nan')
inf = float('inf')
diff --git a/simplejson/ordered_dict.py b/simplejson/ordered_dict.py
index 87ad888..d5a55eb 100644
--- a/simplejson/ordered_dict.py
+++ b/simplejson/ordered_dict.py
@@ -5,17 +5,6 @@ http://code.activestate.com/recipes/576693/
"""
from UserDict import DictMixin
-# Modified from original to support Python 2.4, see
-# http://code.google.com/p/simplejson/issues/detail?id=53
-try:
- all
-except NameError:
- def all(seq):
- for elem in seq:
- if not elem:
- return False
- return True
-
class OrderedDict(dict, DictMixin):
def __init__(self, *args, **kwds):
@@ -63,12 +52,7 @@ class OrderedDict(dict, DictMixin):
def popitem(self, last=True):
if not self:
raise KeyError('dictionary is empty')
- # Modified from original to support Python 2.4, see
- # http://code.google.com/p/simplejson/issues/detail?id=53
- if last:
- key = reversed(self).next()
- else:
- key = iter(self).next()
+ key = reversed(self).next() if last else iter(self).next()
value = self.pop(key)
return key, value