diff options
-rw-r--r-- | CHANGES.txt | 5 | ||||
-rw-r--r-- | setup.py | 2 | ||||
-rw-r--r-- | simplejson/__init__.py | 2 | ||||
-rw-r--r-- | simplejson/decoder.py | 2 | ||||
-rw-r--r-- | simplejson/tests/__init__.py | 1 | ||||
-rw-r--r-- | simplejson/tests/test_errors.py | 17 |
6 files changed, 26 insertions, 3 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 0089b82..f86af13 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,8 @@ +Version 2.1.2 released XXXX-XX-XX + +* Fix the endlineno, endcolno attributes of the JSONDecodeError exception. + http://code.google.com/p/simplejson/issues/detail?id=81 + Version 2.1.1 released 2010-03-31 * Change how setup.py imports ez_setup.py to try and workaround old versions @@ -12,7 +12,7 @@ from distutils.command.build_ext import build_ext from distutils.errors import CCompilerError, DistutilsExecError, \ DistutilsPlatformError -VERSION = '2.1.1' +VERSION = '2.1.2' DESCRIPTION = "Simple, fast, extensible JSON encoder/decoder for Python" LONG_DESCRIPTION = """ simplejson is a simple, fast, complete, correct and extensible diff --git a/simplejson/__init__.py b/simplejson/__init__.py index dcfd541..3857129 100644 --- a/simplejson/__init__.py +++ b/simplejson/__init__.py @@ -97,7 +97,7 @@ Using simplejson.tool from the shell to validate and pretty-print:: $ echo '{ 1.2:3.4}' | python -m simplejson.tool Expecting property name: line 1 column 2 (char 2) """ -__version__ = '2.1.1' +__version__ = '2.1.2' __all__ = [ 'dump', 'dumps', 'load', 'loads', 'JSONDecoder', 'JSONDecodeError', 'JSONEncoder', diff --git a/simplejson/decoder.py b/simplejson/decoder.py index 4cf4015..9dd7fcb 100644 --- a/simplejson/decoder.py +++ b/simplejson/decoder.py @@ -50,7 +50,7 @@ class JSONDecodeError(ValueError): self.end = end self.lineno, self.colno = linecol(doc, pos) if end is not None: - self.endlineno, self.endcolno = linecol(doc, pos) + self.endlineno, self.endcolno = linecol(doc, end) else: self.endlineno, self.endcolno = None, None diff --git a/simplejson/tests/__init__.py b/simplejson/tests/__init__.py index 22d8465..d713521 100644 --- a/simplejson/tests/__init__.py +++ b/simplejson/tests/__init__.py @@ -33,6 +33,7 @@ def all_tests_suite(): 'simplejson.tests.test_dump', 'simplejson.tests.test_encode_basestring_ascii', 'simplejson.tests.test_encode_for_html', + 'simplejson.tests.test_errors', 'simplejson.tests.test_fail', 'simplejson.tests.test_float', 'simplejson.tests.test_indent', diff --git a/simplejson/tests/test_errors.py b/simplejson/tests/test_errors.py new file mode 100644 index 0000000..9b7d971 --- /dev/null +++ b/simplejson/tests/test_errors.py @@ -0,0 +1,17 @@ +from unittest import TestCase + +import simplejson as json + +class TestErrors(TestCase): + def test_decode_error(self): + err = None + try: + json.loads('{}\na\nb') + except json.JSONDecodeError, e: + err = e + else: + self.fail('Expected JSONDecodeError') + self.assertEquals(err.lineno, 2) + self.assertEquals(err.colno, 1) + self.assertEquals(err.endlineno, 3) + self.assertEquals(err.endcolno, 2) |