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

This commit is contained in:
Georg Brandl
2010-08-05 12:02:27 +02:00
parent 01c501054e
commit 29547f7981
2 changed files with 6 additions and 1 deletions

View File

@@ -1,6 +1,9 @@
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.

View File

@@ -13,8 +13,10 @@ import UserString
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