dmeranda / demjson

Python module for JSON data encoding, including jsonlint. See the project Wiki here on Github. Also read the README at the bottom of this page, or the project homepage at
http://deron.meranda.us/python/demjson/
Other
302 stars 76 forks source link

Broken decode() backwards compatibility #9

Closed cwillu closed 9 years ago

cwillu commented 10 years ago

Previously, demjson.decode() was documented as having the following signature:

decode(txt, strict=False, encoding=None, **kw)

Now it has the following signature:

decode(txt, encoding=None, **kw)

This breaks code that assumes that strict is the second positional keyword.

Additionally, the resulting error is non-obvious:

>>> demjson.decode('{}', True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/demjson.py", line 5701, in decode
    return_stats=(return_stats or write_stats) )
  File "/usr/local/lib/python2.7/dist-packages/demjson.py", line 4917, in decode
    raise errors[0]
demjson.JSONDecodeError: a Unicode decoding error occurred
dmeranda commented 10 years ago

What version were you coming from and going to? From 1.x to 2.x, or something different?

Note that demjson 2.0 was a major release that introduced many backwards incompatibilities from 1.x versions. I attempted to document everything, though this particular function signature change may not have been.

You can read about most of the changes here: http://deron.meranda.us/python/demjson/changes

dmeranda commented 9 years ago

Closing.