Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
fa658275
Kaydet (Commit)
fa658275
authored
Kas 02, 2010
tarafından
Barry Warsaw
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue 10038. Restore the Python 2.6 behavior that json.loads() always returns
unicode. Patch by Patch by Walter Dörwald.
üst
921387ba
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
35 deletions
+20
-35
test_unicode.py
Lib/json/tests/test_unicode.py
+2
-0
NEWS
Misc/NEWS
+11
-7
_json.c
Modules/_json.c
+7
-28
No files found.
Lib/json/tests/test_unicode.py
Dosyayı görüntüle @
fa658275
...
...
@@ -78,3 +78,5 @@ class TestUnicode(TestCase):
self
.
assertEquals
(
type
(
json
.
loads
(
u'""'
)),
unicode
)
self
.
assertEquals
(
type
(
json
.
loads
(
u'"a"'
)),
unicode
)
self
.
assertEquals
(
type
(
json
.
loads
(
u'["a"]'
)[
0
]),
unicode
)
# Issue 10038.
self
.
assertEquals
(
type
(
json
.
loads
(
'"foo"'
)),
unicode
)
Misc/NEWS
Dosyayı görüntüle @
fa658275
...
...
@@ -13,11 +13,11 @@ Core and Builtins
- Issue #10221: dict.pop(k) now has a key error message that includes the
missing key (same message d[k] returns for missing keys).
- Issue #10125: Don't segfault when the iterator passed to
``file.writelines()``
closes the file.
- Issue #10125: Don't segfault when the iterator passed to
``file.writelines()``
closes the file.
- Issue #10186: Fix the SyntaxError caret when the offset is equal to the
length
of the offending line.
- Issue #10186: Fix the SyntaxError caret when the offset is equal to the
length
of the offending line.
- Issue #9997: Don't let the name "top" have special significance in scope
resolution.
...
...
@@ -66,10 +66,14 @@ Core and Builtins
Library
-------
- Issue 120176: Wrapped TestSuite subclass does not get __call__ executed
- Issue #10038: json.loads() on str should always return unicode (regression
from Python 2.6). Patch by Walter Dörwald.
- Issue 6706: asyncore accept() method no longer raises EWOULDBLOCK/ECONNABORTED
on incomplete connection attempt but returns None instead.
- Issue #120176: Wrapped TestSuite subclass does not get __call__ executed.
- Issue #6706: asyncore accept() method no longer raises
EWOULDBLOCK/ECONNABORTED on incomplete connection attempt but returns None
instead.
- Issue #10266: uu.decode didn't close in_file explicitly when it was given
as a filename. Patch by Brian Brazil.
...
...
Modules/_json.c
Dosyayı görüntüle @
fa658275
...
...
@@ -440,7 +440,6 @@ scanstring_str(PyObject *pystr, Py_ssize_t end, char *encoding, int strict, Py_s
Py_ssize_t
len
=
PyString_GET_SIZE
(
pystr
);
Py_ssize_t
begin
=
end
-
1
;
Py_ssize_t
next
;
int
has_unicode
=
0
;
char
*
buf
=
PyString_AS_STRING
(
pystr
);
PyObject
*
chunks
=
PyList_New
(
0
);
if
(
chunks
==
NULL
)
{
...
...
@@ -463,9 +462,6 @@ scanstring_str(PyObject *pystr, Py_ssize_t end, char *encoding, int strict, Py_s
raise_errmsg
(
"Invalid control character at"
,
pystr
,
next
);
goto
bail
;
}
else
if
(
c
>
0x7f
)
{
has_unicode
=
1
;
}
}
if
(
!
(
c
==
'"'
||
c
==
'\\'
))
{
raise_errmsg
(
"Unterminated string starting at"
,
pystr
,
begin
);
...
...
@@ -477,15 +473,10 @@ scanstring_str(PyObject *pystr, Py_ssize_t end, char *encoding, int strict, Py_s
if
(
strchunk
==
NULL
)
{
goto
bail
;
}
if
(
has_unicode
)
{
chunk
=
PyUnicode_FromEncodedObject
(
strchunk
,
encoding
,
NULL
);
Py_DECREF
(
strchunk
);
if
(
chunk
==
NULL
)
{
goto
bail
;
}
}
else
{
chunk
=
strchunk
;
chunk
=
PyUnicode_FromEncodedObject
(
strchunk
,
encoding
,
NULL
);
Py_DECREF
(
strchunk
);
if
(
chunk
==
NULL
)
{
goto
bail
;
}
if
(
PyList_Append
(
chunks
,
chunk
))
{
Py_DECREF
(
chunk
);
...
...
@@ -593,21 +584,9 @@ scanstring_str(PyObject *pystr, Py_ssize_t end, char *encoding, int strict, Py_s
}
#endif
}
if
(
c
>
0x7f
)
{
has_unicode
=
1
;
}
if
(
has_unicode
)
{
chunk
=
PyUnicode_FromUnicode
(
&
c
,
1
);
if
(
chunk
==
NULL
)
{
goto
bail
;
}
}
else
{
char
c_char
=
Py_CHARMASK
(
c
);
chunk
=
PyString_FromStringAndSize
(
&
c_char
,
1
);
if
(
chunk
==
NULL
)
{
goto
bail
;
}
chunk
=
PyUnicode_FromUnicode
(
&
c
,
1
);
if
(
chunk
==
NULL
)
{
goto
bail
;
}
if
(
PyList_Append
(
chunks
,
chunk
))
{
Py_DECREF
(
chunk
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment