summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2009-02-27 05:14:11 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2009-02-27 05:14:11 +0000
commite20f09c2d047d782b4b471b2e8cf4a910b338db6 (patch)
treeabf61770d1bf75570c5f9a447a49298b533b245f /django
parent0dd4ec654f4b22854df841d9ea8f463fdbdf99c3 (diff)
Fixed #10006 -- Avoid inadvertently using third-party "json" module.
In r9707 we added a preference to use Python's standard json module (Python 2.6 and beyond). However, there is also a third-party module called json that was being picked up by accident if it was installed. It isn't API compatible, so bad things happened. This change avoids that problem. Patch from markmuetz. git-svn-id: http://code.djangoproject.com/svn/django/trunk@9910 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/utils/simplejson/__init__.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/django/utils/simplejson/__init__.py b/django/utils/simplejson/__init__.py
index 2be6c3909c..9a8c5a348a 100644
--- a/django/utils/simplejson/__init__.py
+++ b/django/utils/simplejson/__init__.py
@@ -119,8 +119,14 @@ except ImportError:
if not use_system_version:
try:
from json import * # Python 2.6 preferred over local copy.
+
+ # There is a "json" package around that is not Python's "json", so we
+ # check for something that is only in the namespace of the version we
+ # want.
+ JSONDecoder
+
use_system_version = True
- except ImportError:
+ except (ImportError, NameError):
pass
# If all else fails, we have a bundled version that can be used.