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
187177fc
Kaydet (Commit)
187177fc
authored
Ara 08, 2009
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #6986: Fix crash in the JSON C accelerator when called with the
wrong parameter types. Patch by Victor Stinner.
üst
4b7f9439
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
6 deletions
+31
-6
test_speedups.py
Lib/json/tests/test_speedups.py
+11
-2
NEWS
Misc/NEWS
+3
-0
_json.c
Modules/_json.c
+17
-4
No files found.
Lib/json/tests/test_speedups.py
Dosyayı görüntüle @
187177fc
import
decimal
import
decimal
from
unittest
import
TestCase
from
unittest
import
TestCase
from
json
import
decoder
from
json
import
decoder
,
encoder
,
scanner
from
json
import
encoder
class
TestSpeedups
(
TestCase
):
class
TestSpeedups
(
TestCase
):
def
test_scanstring
(
self
):
def
test_scanstring
(
self
):
...
@@ -13,3 +12,13 @@ class TestSpeedups(TestCase):
...
@@ -13,3 +12,13 @@ class TestSpeedups(TestCase):
self
.
assertEquals
(
encoder
.
encode_basestring_ascii
.
__module__
,
"_json"
)
self
.
assertEquals
(
encoder
.
encode_basestring_ascii
.
__module__
,
"_json"
)
self
.
assertTrue
(
encoder
.
encode_basestring_ascii
is
self
.
assertTrue
(
encoder
.
encode_basestring_ascii
is
encoder
.
c_encode_basestring_ascii
)
encoder
.
c_encode_basestring_ascii
)
class
TestDecode
(
TestCase
):
def
test_make_scanner
(
self
):
self
.
assertRaises
(
AttributeError
,
scanner
.
c_make_scanner
,
1
)
def
test_make_encoder
(
self
):
self
.
assertRaises
(
TypeError
,
encoder
.
c_make_encoder
,
None
,
"
\xCD\x7D\x3D\x4E\x12\x4C\xF9\x79\xD7\x52\xBA\x82\xF2\x27\x4A\x7D\xA0\xCA\x75
"
,
None
)
Misc/NEWS
Dosyayı görüntüle @
187177fc
...
@@ -509,6 +509,9 @@ Core and Builtins
...
@@ -509,6 +509,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #6986: Fix crash in the JSON C accelerator when called with the
wrong parameter types. Patch by Victor Stinner.
- logging: Added optional `secure` parameter to SMTPHandler, to enable use of
- logging: Added optional `secure` parameter to SMTPHandler, to enable use of
TLS with authentication credentials.
TLS with authentication credentials.
...
...
Modules/_json.c
Dosyayı görüntüle @
187177fc
...
@@ -1731,6 +1731,8 @@ scanner_init(PyObject *self, PyObject *args, PyObject *kwds)
...
@@ -1731,6 +1731,8 @@ scanner_init(PyObject *self, PyObject *args, PyObject *kwds)
/* PyString_AS_STRING is used on encoding */
/* PyString_AS_STRING is used on encoding */
s
->
encoding
=
PyObject_GetAttrString
(
ctx
,
"encoding"
);
s
->
encoding
=
PyObject_GetAttrString
(
ctx
,
"encoding"
);
if
(
s
->
encoding
==
NULL
)
goto
bail
;
if
(
s
->
encoding
==
Py_None
)
{
if
(
s
->
encoding
==
Py_None
)
{
Py_DECREF
(
Py_None
);
Py_DECREF
(
Py_None
);
s
->
encoding
=
PyString_InternFromString
(
DEFAULT_ENCODING
);
s
->
encoding
=
PyString_InternFromString
(
DEFAULT_ENCODING
);
...
@@ -1847,15 +1849,28 @@ encoder_init(PyObject *self, PyObject *args, PyObject *kwds)
...
@@ -1847,15 +1849,28 @@ encoder_init(PyObject *self, PyObject *args, PyObject *kwds)
static
char
*
kwlist
[]
=
{
"markers"
,
"default"
,
"encoder"
,
"indent"
,
"key_separator"
,
"item_separator"
,
"sort_keys"
,
"skipkeys"
,
"allow_nan"
,
NULL
};
static
char
*
kwlist
[]
=
{
"markers"
,
"default"
,
"encoder"
,
"indent"
,
"key_separator"
,
"item_separator"
,
"sort_keys"
,
"skipkeys"
,
"allow_nan"
,
NULL
};
PyEncoderObject
*
s
;
PyEncoderObject
*
s
;
PyObject
*
allow_nan
;
PyObject
*
markers
,
*
defaultfn
,
*
encoder
,
*
indent
,
*
key_separator
;
PyObject
*
item_separator
,
*
sort_keys
,
*
skipkeys
,
*
allow_nan
;
assert
(
PyEncoder_Check
(
self
));
assert
(
PyEncoder_Check
(
self
));
s
=
(
PyEncoderObject
*
)
self
;
s
=
(
PyEncoderObject
*
)
self
;
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwds
,
"OOOOOOOOO:make_encoder"
,
kwlist
,
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwds
,
"OOOOOOOOO:make_encoder"
,
kwlist
,
&
s
->
markers
,
&
s
->
defaultfn
,
&
s
->
encoder
,
&
s
->
indent
,
&
s
->
key_separator
,
&
s
->
item_separator
,
&
s
->
sort_keys
,
&
s
->
skipkeys
,
&
allow_nan
))
&
markers
,
&
defaultfn
,
&
encoder
,
&
indent
,
&
key_separator
,
&
item_separator
,
&
sort_keys
,
&
skipkeys
,
&
allow_nan
))
return
-
1
;
return
-
1
;
s
->
markers
=
markers
;
s
->
defaultfn
=
defaultfn
;
s
->
encoder
=
encoder
;
s
->
indent
=
indent
;
s
->
key_separator
=
key_separator
;
s
->
item_separator
=
item_separator
;
s
->
sort_keys
=
sort_keys
;
s
->
skipkeys
=
skipkeys
;
s
->
fast_encode
=
(
PyCFunction_Check
(
s
->
encoder
)
&&
PyCFunction_GetFunction
(
s
->
encoder
)
==
(
PyCFunction
)
py_encode_basestring_ascii
);
s
->
allow_nan
=
PyObject_IsTrue
(
allow_nan
);
Py_INCREF
(
s
->
markers
);
Py_INCREF
(
s
->
markers
);
Py_INCREF
(
s
->
defaultfn
);
Py_INCREF
(
s
->
defaultfn
);
Py_INCREF
(
s
->
encoder
);
Py_INCREF
(
s
->
encoder
);
...
@@ -1864,8 +1879,6 @@ encoder_init(PyObject *self, PyObject *args, PyObject *kwds)
...
@@ -1864,8 +1879,6 @@ encoder_init(PyObject *self, PyObject *args, PyObject *kwds)
Py_INCREF
(
s
->
item_separator
);
Py_INCREF
(
s
->
item_separator
);
Py_INCREF
(
s
->
sort_keys
);
Py_INCREF
(
s
->
sort_keys
);
Py_INCREF
(
s
->
skipkeys
);
Py_INCREF
(
s
->
skipkeys
);
s
->
fast_encode
=
(
PyCFunction_Check
(
s
->
encoder
)
&&
PyCFunction_GetFunction
(
s
->
encoder
)
==
(
PyCFunction
)
py_encode_basestring_ascii
);
s
->
allow_nan
=
PyObject_IsTrue
(
allow_nan
);
return
0
;
return
0
;
}
}
...
...
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