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
405952f1
Kaydet (Commit)
405952f1
authored
Mar 12, 2013
tarafından
Ezio Melotti
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
#17368: merge with 3.3.
üst
7192eddb
220391fa
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
5 deletions
+15
-5
decoder.py
Lib/json/decoder.py
+1
-1
test_decode.py
Lib/test/json_tests/test_decode.py
+10
-4
NEWS
Misc/NEWS
+4
-0
No files found.
Lib/json/decoder.py
Dosyayı görüntüle @
405952f1
...
...
@@ -158,7 +158,7 @@ def JSONObject(s_and_end, strict, scan_once, object_hook, object_pairs_hook,
if
nextchar
==
'}'
:
if
object_pairs_hook
is
not
None
:
result
=
object_pairs_hook
(
pairs
)
return
result
,
end
return
result
,
end
+
1
pairs
=
{}
if
object_hook
is
not
None
:
pairs
=
object_hook
(
pairs
)
...
...
Lib/test/json_tests/test_decode.py
Dosyayı görüntüle @
405952f1
...
...
@@ -25,16 +25,22 @@ class TestDecode:
p
=
[(
"xkd"
,
1
),
(
"kcw"
,
2
),
(
"art"
,
3
),
(
"hxm"
,
4
),
(
"qrt"
,
5
),
(
"pad"
,
6
),
(
"hoy"
,
7
)]
self
.
assertEqual
(
self
.
loads
(
s
),
eval
(
s
))
self
.
assertEqual
(
self
.
loads
(
s
,
object_pairs_hook
=
lambda
x
:
x
),
p
)
self
.
assertEqual
(
self
.
loads
(
s
,
object_pairs_hook
=
lambda
x
:
x
),
p
)
self
.
assertEqual
(
self
.
json
.
load
(
StringIO
(
s
),
object_pairs_hook
=
lambda
x
:
x
),
p
)
od
=
self
.
loads
(
s
,
object_pairs_hook
=
OrderedDict
)
od
=
self
.
loads
(
s
,
object_pairs_hook
=
OrderedDict
)
self
.
assertEqual
(
od
,
OrderedDict
(
p
))
self
.
assertEqual
(
type
(
od
),
OrderedDict
)
# the object_pairs_hook takes priority over the object_hook
self
.
assertEqual
(
self
.
loads
(
s
,
object_pairs_hook
=
OrderedDict
,
object_hook
=
lambda
x
:
None
),
self
.
assertEqual
(
self
.
loads
(
s
,
object_pairs_hook
=
OrderedDict
,
object_hook
=
lambda
x
:
None
),
OrderedDict
(
p
))
# check that empty objects literals work (see #17368)
self
.
assertEqual
(
self
.
loads
(
'{}'
,
object_pairs_hook
=
OrderedDict
),
OrderedDict
())
self
.
assertEqual
(
self
.
loads
(
'{"empty": {}}'
,
object_pairs_hook
=
OrderedDict
),
OrderedDict
([(
'empty'
,
OrderedDict
())]))
def
test_decoder_optimizations
(
self
):
# Several optimizations were made that skip over calls to
...
...
Misc/NEWS
Dosyayı görüntüle @
405952f1
...
...
@@ -277,6 +277,10 @@ Core and Builtins
Library
-------
-
Issue
#
17368
:
Fix
an
off
-
by
-
one
error
in
the
Python
JSON
decoder
that
caused
a
failure
while
decoding
empty
object
literals
when
object_pairs_hook
was
specified
.
_
Issue
#
17385
:
Fix
quadratic
behavior
in
threading
.
Condition
.
The
FIFO
queue
now
uses
a
deque
instead
of
a
list
.
...
...
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