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
2d24e94b
Kaydet (Commit)
2d24e94b
authored
Haz 28, 2012
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #5067: improve some json error messages.
Patch by Serhiy Storchaka.
üst
24319ac4
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
12 deletions
+14
-12
json.rst
Doc/library/json.rst
+1
-1
__init__.py
Lib/json/__init__.py
+1
-1
decoder.py
Lib/json/decoder.py
+7
-5
tool.py
Lib/json/tool.py
+1
-1
_json.c
Modules/_json.c
+4
-4
No files found.
Doc/library/json.rst
Dosyayı görüntüle @
2d24e94b
...
...
@@ -99,7 +99,7 @@ Using json.tool from the shell to validate and pretty-print::
"json": "obj"
}
$ echo '{1.2:3.4}' | python -mjson.tool
Expecting property name: line 1 column 1 (char 1)
Expecting property name
enclosed in double quotes
: line 1 column 1 (char 1)
.. highlight:: python3
...
...
Lib/json/__init__.py
Dosyayı görüntüle @
2d24e94b
...
...
@@ -97,7 +97,7 @@ Using json.tool from the shell to validate and pretty-print::
"json": "obj"
}
$ echo '{ 1.2:3.4}' | python -m json.tool
Expecting property name: line 1 column 2 (char 2)
Expecting property name
enclosed in double quotes
: line 1 column 2 (char 2)
"""
__version__
=
'2.0.9'
__all__
=
[
...
...
Lib/json/decoder.py
Dosyayı görüntüle @
2d24e94b
...
...
@@ -173,7 +173,8 @@ def JSONObject(s_and_end, strict, scan_once, object_hook, object_pairs_hook,
pairs
=
object_hook
(
pairs
)
return
pairs
,
end
+
1
elif
nextchar
!=
'"'
:
raise
ValueError
(
errmsg
(
"Expecting property name"
,
s
,
end
))
raise
ValueError
(
errmsg
(
"Expecting property name enclosed in double quotes"
,
s
,
end
))
end
+=
1
while
True
:
key
,
end
=
scanstring
(
s
,
end
,
strict
)
...
...
@@ -183,7 +184,7 @@ def JSONObject(s_and_end, strict, scan_once, object_hook, object_pairs_hook,
if
s
[
end
:
end
+
1
]
!=
':'
:
end
=
_w
(
s
,
end
)
.
end
()
if
s
[
end
:
end
+
1
]
!=
':'
:
raise
ValueError
(
errmsg
(
"Expecting
:
delimiter"
,
s
,
end
))
raise
ValueError
(
errmsg
(
"Expecting
':'
delimiter"
,
s
,
end
))
end
+=
1
try
:
...
...
@@ -211,12 +212,13 @@ def JSONObject(s_and_end, strict, scan_once, object_hook, object_pairs_hook,
if
nextchar
==
'}'
:
break
elif
nextchar
!=
','
:
raise
ValueError
(
errmsg
(
"Expecting
,
delimiter"
,
s
,
end
-
1
))
raise
ValueError
(
errmsg
(
"Expecting
','
delimiter"
,
s
,
end
-
1
))
end
=
_w
(
s
,
end
)
.
end
()
nextchar
=
s
[
end
:
end
+
1
]
end
+=
1
if
nextchar
!=
'"'
:
raise
ValueError
(
errmsg
(
"Expecting property name"
,
s
,
end
-
1
))
raise
ValueError
(
errmsg
(
"Expecting property name enclosed in double quotes"
,
s
,
end
-
1
))
if
object_pairs_hook
is
not
None
:
result
=
object_pairs_hook
(
pairs
)
return
result
,
end
...
...
@@ -250,7 +252,7 @@ def JSONArray(s_and_end, scan_once, _w=WHITESPACE.match, _ws=WHITESPACE_STR):
if
nextchar
==
']'
:
break
elif
nextchar
!=
','
:
raise
ValueError
(
errmsg
(
"Expecting
,
delimiter"
,
s
,
end
))
raise
ValueError
(
errmsg
(
"Expecting
','
delimiter"
,
s
,
end
))
try
:
if
s
[
end
]
in
_ws
:
end
+=
1
...
...
Lib/json/tool.py
Dosyayı görüntüle @
2d24e94b
...
...
@@ -7,7 +7,7 @@ Usage::
"json": "obj"
}
$ echo '{ 1.2:3.4}' | python -m json.tool
Expecting property name: line 1 column 2 (char 2)
Expecting property name
enclosed in double quotes
: line 1 column 2 (char 2)
"""
import
sys
...
...
Modules/_json.c
Dosyayı görüntüle @
2d24e94b
...
...
@@ -634,7 +634,7 @@ _parse_object_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ss
/* read key */
if
(
str
[
idx
]
!=
'"'
)
{
raise_errmsg
(
"Expecting property name"
,
pystr
,
idx
);
raise_errmsg
(
"Expecting property name
enclosed in double quotes
"
,
pystr
,
idx
);
goto
bail
;
}
key
=
scanstring_unicode
(
pystr
,
idx
+
1
,
strict
,
&
next_idx
);
...
...
@@ -655,7 +655,7 @@ _parse_object_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ss
/* skip whitespace between key and : delimiter, read :, skip whitespace */
while
(
idx
<=
end_idx
&&
IS_WHITESPACE
(
str
[
idx
]))
idx
++
;
if
(
idx
>
end_idx
||
str
[
idx
]
!=
':'
)
{
raise_errmsg
(
"Expecting
:
delimiter"
,
pystr
,
idx
);
raise_errmsg
(
"Expecting
':'
delimiter"
,
pystr
,
idx
);
goto
bail
;
}
idx
++
;
...
...
@@ -695,7 +695,7 @@ _parse_object_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ss
break
;
}
else
if
(
str
[
idx
]
!=
','
)
{
raise_errmsg
(
"Expecting
,
delimiter"
,
pystr
,
idx
);
raise_errmsg
(
"Expecting
','
delimiter"
,
pystr
,
idx
);
goto
bail
;
}
idx
++
;
...
...
@@ -777,7 +777,7 @@ _parse_array_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssi
break
;
}
else
if
(
str
[
idx
]
!=
','
)
{
raise_errmsg
(
"Expecting
,
delimiter"
,
pystr
,
idx
);
raise_errmsg
(
"Expecting
','
delimiter"
,
pystr
,
idx
);
goto
bail
;
}
idx
++
;
...
...
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