mirror of
https://github.com/ultrajson/ultrajson.git
synced 2024-11-24 05:12:02 +01:00
Fixed long forgotten memory leak in file object handling code for Python
This commit is contained in:
parent
0ddd990e24
commit
b243a4a0d7
@ -795,6 +795,8 @@ PyObject* objToJSONFile(PyObject* self, PyObject *args, PyObject *kwargs)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Py_XDECREF(argtuple);
|
||||
|
||||
argtuple = PyTuple_Pack (1, string);
|
||||
if (argtuple == NULL)
|
||||
{
|
||||
@ -809,7 +811,7 @@ PyObject* objToJSONFile(PyObject* self, PyObject *args, PyObject *kwargs)
|
||||
}
|
||||
|
||||
Py_XDECREF(write);
|
||||
Py_XDECREF(argtuple);
|
||||
Py_DECREF(argtuple);
|
||||
Py_XDECREF(string);
|
||||
|
||||
PRINTMARK();
|
||||
|
@ -15,7 +15,7 @@ import StringIO
|
||||
import re
|
||||
|
||||
class UltraJSONTests(TestCase):
|
||||
"""
|
||||
|
||||
def test_encodeDictWithUnicodeKeys(self):
|
||||
input = { u"key1": u"value1", u"key1": u"value1", u"key1": u"value1", u"key1": u"value1", u"key1": u"value1", u"key1": u"value1" }
|
||||
output = ujson.encode(input)
|
||||
@ -214,10 +214,7 @@ class UltraJSONTests(TestCase):
|
||||
self.assertEquals(int(expected), json.loads(output))
|
||||
self.assertEquals(int(expected), ujson.decode(output))
|
||||
pass
|
||||
"""
|
||||
|
||||
"""
|
||||
# FAILING FROM HERE
|
||||
def test_encodeToUTF8(self):
|
||||
input = "\xe6\x97\xa5\xd1\x88"
|
||||
enc = ujson.encode(input, ensure_ascii=False)
|
||||
@ -529,16 +526,6 @@ class UltraJSONTests(TestCase):
|
||||
output = ujson.decode(input)
|
||||
self.assertEquals(output, json.loads(input))
|
||||
|
||||
def test_encodeBigEscape(self):
|
||||
for x in xrange(10):
|
||||
input = "\xc3\xa5" * 1024 * 1024 * 10
|
||||
output = ujson.encode(input)
|
||||
|
||||
def test_decodeBigEscape(self):
|
||||
for x in xrange(10):
|
||||
input = "\"" + ("\xc3\xa5" * 1024 * 1024 * 10) + "\""
|
||||
output = ujson.decode(input)
|
||||
"""
|
||||
def test_dumpToFile(self):
|
||||
f = StringIO.StringIO()
|
||||
ujson.dump([1, 2, 3], f)
|
||||
@ -626,7 +613,15 @@ class UltraJSONTests(TestCase):
|
||||
for doc,result in zip(docs, results):
|
||||
self.assertEqual(ujson.decode(doc)['id'], result)
|
||||
|
||||
def test_encodeBigEscape(self):
|
||||
for x in xrange(10):
|
||||
input = "\xc3\xa5" * 1024 * 1024 * 10
|
||||
output = ujson.encode(input)
|
||||
|
||||
def test_decodeBigEscape(self):
|
||||
for x in xrange(10):
|
||||
input = "\"" + ("\xc3\xa5" * 1024 * 1024 * 10) + "\""
|
||||
output = ujson.decode(input)
|
||||
|
||||
"""
|
||||
def test_decodeNumericIntFrcOverflow(self):
|
||||
|
@ -1 +1 @@
|
||||
#define UJSON_VERSION "1.14"
|
||||
#define UJSON_VERSION "1.15"
|
||||
|
Loading…
Reference in New Issue
Block a user