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
920007ad
Kaydet (Commit)
920007ad
authored
Şub 21, 2013
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Issue #17225: JSON decoder now counts columns in the first line starting
with 1, as in other lines.
üst
fc9bf110
ed891c15
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
10 deletions
+25
-10
json.rst
Doc/library/json.rst
+1
-1
__init__.py
Lib/json/__init__.py
+1
-1
decoder.py
Lib/json/decoder.py
+1
-1
tool.py
Lib/json/tool.py
+1
-1
test_fail.py
Lib/test/json_tests/test_fail.py
+18
-6
NEWS
Misc/NEWS
+3
-0
No files found.
Doc/library/json.rst
Dosyayı görüntüle @
920007ad
...
...
@@ -101,7 +101,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 enclosed in double quotes: line 1 column
1
(char 1)
Expecting property name enclosed in double quotes: line 1 column
2
(char 1)
.. highlight:: python3
...
...
Lib/json/__init__.py
Dosyayı görüntüle @
920007ad
...
...
@@ -96,7 +96,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 enclosed in double quotes: line 1 column
2
(char 2)
Expecting property name enclosed in double quotes: line 1 column
3
(char 2)
"""
__version__
=
'2.0.9'
__all__
=
[
...
...
Lib/json/decoder.py
Dosyayı görüntüle @
920007ad
...
...
@@ -24,7 +24,7 @@ def linecol(doc, pos):
newline
=
'
\n
'
lineno
=
doc
.
count
(
newline
,
0
,
pos
)
+
1
if
lineno
==
1
:
colno
=
pos
colno
=
pos
+
1
else
:
colno
=
pos
-
doc
.
rindex
(
newline
,
0
,
pos
)
return
lineno
,
colno
...
...
Lib/json/tool.py
Dosyayı görüntüle @
920007ad
...
...
@@ -7,7 +7,7 @@ Usage::
"json": "obj"
}
$ echo '{ 1.2:3.4}' | python -m json.tool
Expecting property name enclosed in double quotes: line 1 column
2
(char 2)
Expecting property name enclosed in double quotes: line 1 column
3
(char 2)
"""
import
sys
...
...
Lib/test/json_tests/test_fail.py
Dosyayı görüntüle @
920007ad
...
...
@@ -125,8 +125,8 @@ class TestFail:
]
for
data
,
msg
,
idx
in
test_cases
:
self
.
assertRaisesRegex
(
ValueError
,
r'^{0}: line 1 column {1} \(char {
1
}\)'
.
format
(
re
.
escape
(
msg
),
idx
),
r'^{0}: line 1 column {1} \(char {
2
}\)'
.
format
(
re
.
escape
(
msg
),
idx
+
1
,
idx
),
self
.
loads
,
data
)
def
test_unexpected_data
(
self
):
...
...
@@ -155,8 +155,8 @@ class TestFail:
]
for
data
,
msg
,
idx
in
test_cases
:
self
.
assertRaisesRegex
(
ValueError
,
r'^{0}: line 1 column {1} \(char {
1
}\)'
.
format
(
re
.
escape
(
msg
),
idx
),
r'^{0}: line 1 column {1} \(char {
2
}\)'
.
format
(
re
.
escape
(
msg
),
idx
+
1
,
idx
),
self
.
loads
,
data
)
def
test_extra_data
(
self
):
...
...
@@ -173,10 +173,22 @@ class TestFail:
for
data
,
msg
,
idx
in
test_cases
:
self
.
assertRaisesRegex
(
ValueError
,
r'^{0}: line 1 column {1} - line 1 column {2}'
r' \(char {
1} - {2
}\)'
.
format
(
re
.
escape
(
msg
),
idx
,
len
(
data
)),
r' \(char {
3} - {4
}\)'
.
format
(
re
.
escape
(
msg
),
idx
+
1
,
len
(
data
)
+
1
,
idx
,
len
(
data
)),
self
.
loads
,
data
)
def
test_linecol
(
self
):
test_cases
=
[
(
'!'
,
1
,
1
,
0
),
(
' !'
,
1
,
2
,
1
),
(
'
\n
!'
,
2
,
1
,
1
),
(
'
\n
\n\n
!'
,
4
,
6
,
10
),
]
for
data
,
line
,
col
,
idx
in
test_cases
:
self
.
assertRaisesRegex
(
ValueError
,
r'^Expecting value: line {0} column {1}'
r' \(char {2}\)$'
.
format
(
line
,
col
,
idx
),
self
.
loads
,
data
)
class
TestPyFail
(
TestFail
,
PyTest
):
pass
class
TestCFail
(
TestFail
,
CTest
):
pass
Misc/NEWS
Dosyayı görüntüle @
920007ad
...
...
@@ -260,6 +260,9 @@ Core and Builtins
Library
-------
-
Issue
#
17225
:
JSON
decoder
now
counts
columns
in
the
first
line
starting
with
1
,
as
in
other
lines
.
-
Issue
#
6623
:
Added
explicit
DeprecationWarning
for
ftplib
.
netrc
,
which
has
been
deprecated
and
undocumented
for
a
long
time
.
...
...
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