summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Ippolito <bob@redivi.com>2010-07-12 18:23:51 +0000
committerBob Ippolito <bob@redivi.com>2010-07-12 18:23:51 +0000
commitc90a0623978ac5eb6c10b5d49f4c05774c245092 (patch)
tree891cce71e8097c99f1526094563590a978768ec0
parentbfa06f188d9451a77c6e1ba2a9d72fd42a557ab1 (diff)
downloadsimplejson-c90a0623978ac5eb6c10b5d49f4c05774c245092.tar.gz
http://code.google.com/p/simplejson/issues/detail?id=81
git-svn-id: http://simplejson.googlecode.com/svn/trunk@232 a4795897-2c25-0410-b006-0d3caba88fa1
-rw-r--r--CHANGES.txt5
-rw-r--r--setup.py2
-rw-r--r--simplejson/__init__.py2
-rw-r--r--simplejson/decoder.py2
-rw-r--r--simplejson/tests/__init__.py1
-rw-r--r--simplejson/tests/test_errors.py17
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
diff --git a/setup.py b/setup.py
index 04956f0..dcc56c5 100644
--- a/setup.py
+++ b/setup.py
@@ -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)