Commits

Georg Brandl committed 1982914

#488: Fix crash when json-py is installed, which provides a ``json`` module but is incompatible to simplejson.

Comments (0)

Files changed (2)

 Release 1.0.2 (in development)
 ==============================
 
+* #488: Fix crash when json-py is installed, which provides a
+  ``json`` module but is incompatible to simplejson.
+
 * #480: Fix handling of target naming in intersphinx.
 
 * #486: Fix removal of ``!`` for all cross-reference roles.

sphinx/util/jsonimpl.py

 
 try:
     import json
+    # json-py's json module has not JSONEncoder; this will raise AttributeError
+    # if json-py is imported instead of the built-in json module
     JSONEncoder = json.JSONEncoder
-except ImportError:
+except (ImportError, AttributeError):
     try:
         import simplejson as json
         JSONEncoder = json.JSONEncoder