Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
  • Loading branch information...
commit e20f09c2d047d782b4b471b2e8cf4a910b338db6 1 parent 0dd4ec6
@malcolmt malcolmt authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 django/utils/simplejson/__init__.py
View
8 django/utils/simplejson/__init__.py
@@ -119,8 +119,14 @@
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.
Please sign in to comment.
Something went wrong with that request. Please try again.