[Python-checkins] cpython (2.7): #11982: fix json.loads('""') to return u'' rather than ''.
ezio.melotti
python-checkins at python.org
Wed May 4 13:41:40 CEST 2011
http://hg.python.org/cpython/rev/9d5a50e5d8a2
changeset: 69822:9d5a50e5d8a2
branch: 2.7
parent: 69818:1a2f0f545f55
user: Ezio Melotti <ezio.melotti at gmail.com>
date: Wed May 04 14:40:53 2011 +0300
summary:
#11982: fix json.loads('""') to return u'' rather than ''.
files:
Lib/json/tests/test_decode.py | 3 ++-
Misc/NEWS | 2 ++
Modules/_json.c | 2 +-
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/Lib/json/tests/test_decode.py b/Lib/json/tests/test_decode.py
--- a/Lib/json/tests/test_decode.py
+++ b/Lib/json/tests/test_decode.py
@@ -26,7 +26,8 @@
def test_empty_objects(self):
self.assertEqual(json.loads('{}'), {})
self.assertEqual(json.loads('[]'), [])
- self.assertEqual(json.loads('""'), "")
+ self.assertEqual(json.loads('""'), u"")
+ self.assertIsInstance(json.loads('""'), unicode)
def test_object_pairs_hook(self):
s = '{"xkd":1, "kcw":2, "art":3, "hxm":4, "qrt":5, "pad":6, "hoy":7}'
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -77,6 +77,8 @@
Library
-------
+- Issue #11982: fix json.loads('""') to return u'' rather than ''.
+
- Issue #11277: mmap.mmap() calls fcntl(fd, F_FULLFSYNC) on Mac OS X to get
around a mmap bug with sparse files. Patch written by Steffen Daode Nurpmeso.
diff --git a/Modules/_json.c b/Modules/_json.c
--- a/Modules/_json.c
+++ b/Modules/_json.c
@@ -595,7 +595,7 @@
Py_DECREF(chunk);
}
- rval = join_list_string(chunks);
+ rval = join_list_unicode(chunks);
if (rval == NULL) {
goto bail;
}
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list