diff options
author | Bob Ippolito <bob@redivi.com> | 2010-07-19 04:20:43 +0000 |
---|---|---|
committer | Bob Ippolito <bob@redivi.com> | 2010-07-19 04:20:43 +0000 |
commit | 5075072f866a4ef098cc9ce4dd7f879fc040edcd (patch) | |
tree | 05a1ed00ad89ea660d4fbda1e9dd39481f7dd7aa /simplejson | |
parent | c90a0623978ac5eb6c10b5d49f4c05774c245092 (diff) | |
download | simplejson-5075072f866a4ef098cc9ce4dd7f879fc040edcd.tar.gz |
http://code.google.com/p/simplejson/issues/detail?id=82
git-svn-id: http://simplejson.googlecode.com/svn/trunk@233 a4795897-2c25-0410-b006-0d3caba88fa1
Diffstat (limited to 'simplejson')
-rw-r--r-- | simplejson/_speedups.c | 2 | ||||
-rw-r--r-- | simplejson/tests/test_errors.py | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/simplejson/_speedups.c b/simplejson/_speedups.c index b06ba50..3f13f10 100644 --- a/simplejson/_speedups.c +++ b/simplejson/_speedups.c @@ -2277,7 +2277,7 @@ encoder_listencode_dict(PyEncoderObject *s, PyObject *rval, PyObject *dct, Py_ss } else { /* TODO: include repr of key */ - PyErr_SetString(PyExc_ValueError, "keys must be a string"); + PyErr_SetString(PyExc_TypeError, "keys must be a string"); goto bail; } diff --git a/simplejson/tests/test_errors.py b/simplejson/tests/test_errors.py index 9b7d971..c8b836a 100644 --- a/simplejson/tests/test_errors.py +++ b/simplejson/tests/test_errors.py @@ -3,6 +3,10 @@ from unittest import TestCase import simplejson as json class TestErrors(TestCase): + def test_string_keys_error(self): + data = [{'a': 'A', 'b': (2, 4), 'c': 3.0, ('d',): 'D tuple'}] + self.assertRaises(TypeError, json.dumps, data) + def test_decode_error(self): err = None try: |