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: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 0dd4ec6 commit e20f09c2d047d782b4b471b2e8cf4a910b338db6 @malcolmt malcolmt committed Feb 27, 2009
Showing with 7 additions and 1 deletion.
  1. +7 −1 django/utils/simplejson/
@@ -119,8 +119,14 @@
if not use_system_version:
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):
# If all else fails, we have a bundled version that can be used.

0 comments on commit e20f09c

Please sign in to comment.