From daf0fde4c9011df141772d7b1ffe848237f03548 Mon Sep 17 00:00:00 2001 From: Jonas Tarnstrom Date: Fri, 9 Sep 2011 17:13:31 +0200 Subject: [PATCH] - Fixed issue with parsing kwargs - Fixed test for ensure_ascii - Bumped version - Fixed / decoding issue in lookup tables --- python/objToJSON.c | 4 ++-- python/tests.py | 4 ++-- python/version.h | 2 +- ultrajsonenc.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/python/objToJSON.c b/python/objToJSON.c index dec3420..fe03091 100644 --- a/python/objToJSON.c +++ b/python/objToJSON.c @@ -664,7 +664,7 @@ char *Object_iterGetName(JSOBJ obj, JSONTypeContext *tc, size_t *outLen) PyObject* objToJSON(PyObject* self, PyObject *args, PyObject *kwargs) { - static char *kwlist[] = { "ensure_ascii", NULL}; + static char *kwlist[] = { "obj", "ensure_ascii", NULL}; char buffer[65536]; char *ret; @@ -698,7 +698,7 @@ PyObject* objToJSON(PyObject* self, PyObject *args, PyObject *kwargs) if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|O", kwlist, &oinput, &oensureAscii)) { - return PyErr_Format(PyExc_TypeError, "Expected object, **kw ensure_ascii true/false"); + return NULL; } if (oensureAscii != NULL && !PyObject_IsTrue(oensureAscii)) diff --git a/python/tests.py b/python/tests.py index 7958be8..2ff09ce 100644 --- a/python/tests.py +++ b/python/tests.py @@ -217,9 +217,9 @@ class UltraJSONTests(TestCase): def test_encodeToUTF8(self): input = "\xe6\x97\xa5\xd1\x88" - enc = ujson.encode(input, ensure_ascii=false) + enc = ujson.encode(input, ensure_ascii=False) dec = ujson.decode(enc) - self.assertEquals(enc, json.dumps(input, encoding="utf-8")) + self.assertEquals(enc, json.dumps(input, encoding="utf-8", ensure_ascii=False)) self.assertEquals(dec, json.loads(enc)) diff --git a/python/version.h b/python/version.h index 017dfcb..8e5ba3e 100644 --- a/python/version.h +++ b/python/version.h @@ -1 +1 @@ -#define UJSON_VERSION "1.7" +#define UJSON_VERSION "1.8" diff --git a/ultrajsonenc.c b/ultrajsonenc.c index c892f5d..7e476c6 100644 --- a/ultrajsonenc.c +++ b/ultrajsonenc.c @@ -65,7 +65,7 @@ static const JSUINT8 g_asciiOutputTable[256] = { /* 0x00 */ 0, 30, 30, 30, 30, 30, 30, 30, 10, 12, 14, 30, 16, 18, 30, 30, /* 0x10 */ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, -/* 0x20 */ 1, 1, 20, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 24, +/* 0x20 */ 1, 1, 20, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1/*24*/, /* 0x30 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x40 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x50 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 22, 1, 1, 1,