Ticket #717 (closed defect: fixed)
Fix json/simplejson handling
| Reported by: | dustin | Owned by: | |
|---|---|---|---|
| Priority: | blocker | Milestone: | 0.8.0 |
| Version: | master | Keywords: | |
| Cc: |
Description
http://lists.debian.org/debian-python/2010/02/msg00016.html
Hello everyone,
It seems like python-json should either be renamed of deprecated.
Meanwhile, all the Python application and modules that use JSON should
be careful when importing the json module. Here's how I do it. (see the
code extract below)
# JSON im# JSON import:
try:
import json # python 2.6
except ImportError:
import simplejson as json # python 2.4 to 2.5
try:
_tmp = json.loads
except AttributeError:
import warnings
import sys
warnings.warn("Use simplejson, not the old json module.")
sys.modules.pop('json') # get rid of the bad json module
import simplejson as json
Change History
comment:1 Changed 2 years ago by Dustin J. Mitchell
- Status changed from new to closed
- Resolution set to fixed
comment:2 Changed 20 months ago by Dustin J. Mitchell
Be very careful in how JSON support is imported
And only do it once, in buildbot.util. Fixes #717
Changeset: 161d7fcdccb58b2bae06969912dedf4956978007
Note: See
TracTickets for help on using
tickets.
![[Buildbot Logo]](/chrome/site/header-text-transparent.png)
Be very careful in how JSON support is imported
And only do it once, in buildbot.util. Fixes #717