Re: python2.6 vs python-json
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
Paul Wise wrote:
> So basically, Python upstream hijacked a part of the import namespace.
> Unless they can be convinced to undo that, python-json is clearly at a
> disadvantage and future JSON consuming Python code will likely use the
> Python json module since it comes with Python. Therefore python-json
> needs to be removed or renamed and the reverse dependencies need to
> adapt accordingly. The python-json upstream should be contacted to
> find out future plans for it, to decide if removal or renaming is
> better. The upstreams for the reverse deps probably will want to stay
> compatible with Python 2.5, therefore they need to be checking for the
> new Python API vs the old python-json API vs the possible new name for
> the python-json API and adapt accordingly.
>
> On Sun, Feb 14, 2010 at 7:25 AM, Jakub Wilk <jwilk@debian.org> wrote:
>
>> - conduit contains a (slightly forked?) embedded copy of python-facebook.
>> However, it's a bit more clever with importing, so it'll never use
>> python-json (despite recommending "python (>= 2.6) | python-json").
>
> Please report this embedded code copy to the security team for
> addition to embedded-code-copies:
>
> http://svn.debian.org/wsvn/secure-testing/data/embedded-code-copies
>
Reply to: