diff options
author | Bob Ippolito <bob@redivi.com> | 2008-05-04 01:21:15 +0000 |
---|---|---|
committer | Bob Ippolito <bob@redivi.com> | 2008-05-04 01:21:15 +0000 |
commit | 4b61844e8f78d7e969ea433ceaab8b679ac436f8 (patch) | |
tree | 75a308991de004743cca0e14276aefaec601fb8c /simplejson/decoder.py | |
parent | 5b90128b53c242d7885365b0e98309171bf79ba2 (diff) | |
download | simplejson-4b61844e8f78d7e969ea433ceaab8b679ac436f8.tar.gz |
backport fixes from py2.6 issue2750 branch
git-svn-id: http://simplejson.googlecode.com/svn/trunk@93 a4795897-2c25-0410-b006-0d3caba88fa1
Diffstat (limited to 'simplejson/decoder.py')
-rw-r--r-- | simplejson/decoder.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/simplejson/decoder.py b/simplejson/decoder.py index fbf65ed..baf10e9 100644 --- a/simplejson/decoder.py +++ b/simplejson/decoder.py @@ -6,9 +6,9 @@ import sys from simplejson.scanner import Scanner, pattern try: - from simplejson import _speedups -except: - _speedups = None + from simplejson._speedups import scanstring as c_scanstring +except ImportError: + pass FLAGS = re.VERBOSE | re.MULTILINE | re.DOTALL @@ -83,7 +83,7 @@ BACKSLASH = { DEFAULT_ENCODING = "utf-8" -def scanstring(s, end, encoding=None, strict=True, _b=BACKSLASH, _m=STRINGCHUNK.match): +def py_scanstring(s, end, encoding=None, strict=True, _b=BACKSLASH, _m=STRINGCHUNK.match): if encoding is None: encoding = DEFAULT_ENCODING chunks = [] @@ -147,8 +147,10 @@ def scanstring(s, end, encoding=None, strict=True, _b=BACKSLASH, _m=STRINGCHUNK. # Use speedup -if _speedups is not None: - scanstring = _speedups.scanstring +try: + scanstring = c_scanstring +except NameError: + scanstring = py_scanstring def JSONString(match, context): encoding = getattr(context, 'encoding', None) |