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
e6d4c5ba
Kaydet (Commit)
e6d4c5ba
authored
Ock 23, 2011
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #10987: Fix the recursion limit handling in the _pickle module.
üst
0929b1fc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
14 deletions
+24
-14
NEWS
Misc/NEWS
+2
-0
_pickle.c
Modules/_pickle.c
+19
-12
find_recursionlimit.py
Tools/scripts/find_recursionlimit.py
+3
-2
No files found.
Misc/NEWS
Dosyayı görüntüle @
e6d4c5ba
...
@@ -16,6 +16,8 @@ Core and Builtins
...
@@ -16,6 +16,8 @@ Core and Builtins
Library
Library
-------
-------
- Issue #10987: Fix the recursion limit handling in the _pickle module.
- Issue #10983: Fix several bugs making tunnel requests in http.client.
- Issue #10983: Fix several bugs making tunnel requests in http.client.
- Issue #10955: zipimport uses ASCII encoding instead of cp437 to decode
- Issue #10955: zipimport uses ASCII encoding instead of cp437 to decode
...
...
Modules/_pickle.c
Dosyayı görüntüle @
e6d4c5ba
...
@@ -2244,19 +2244,21 @@ save_list(PicklerObject *self, PyObject *obj)
...
@@ -2244,19 +2244,21 @@ save_list(PicklerObject *self, PyObject *obj)
if
(
len
!=
0
)
{
if
(
len
!=
0
)
{
/* Materialize the list elements. */
/* Materialize the list elements. */
if
(
PyList_CheckExact
(
obj
)
&&
self
->
proto
>
0
)
{
if
(
PyList_CheckExact
(
obj
)
&&
self
->
proto
>
0
)
{
if
(
Py_EnterRecursiveCall
(
" while pickling an object"
)
==
0
)
{
if
(
Py_EnterRecursiveCall
(
" while pickling an object"
)
)
status
=
batch_list_exact
(
self
,
obj
)
;
goto
error
;
Py_LeaveRecursiveCall
(
);
status
=
batch_list_exact
(
self
,
obj
);
}
Py_LeaveRecursiveCall
();
}
else
{
}
else
{
PyObject
*
iter
=
PyObject_GetIter
(
obj
);
PyObject
*
iter
=
PyObject_GetIter
(
obj
);
if
(
iter
==
NULL
)
if
(
iter
==
NULL
)
goto
error
;
goto
error
;
if
(
Py_EnterRecursiveCall
(
" while pickling an object"
)
==
0
)
{
if
(
Py_EnterRecursiveCall
(
" while pickling an object"
))
{
status
=
batch_list
(
self
,
iter
);
Py_DECREF
(
iter
);
Py_LeaveRecursiveCall
()
;
goto
error
;
}
}
status
=
batch_list
(
self
,
iter
);
Py_LeaveRecursiveCall
();
Py_DECREF
(
iter
);
Py_DECREF
(
iter
);
}
}
}
}
...
@@ -2504,10 +2506,10 @@ save_dict(PicklerObject *self, PyObject *obj)
...
@@ -2504,10 +2506,10 @@ save_dict(PicklerObject *self, PyObject *obj)
if
(
PyDict_CheckExact
(
obj
)
&&
self
->
proto
>
0
)
{
if
(
PyDict_CheckExact
(
obj
)
&&
self
->
proto
>
0
)
{
/* We can take certain shortcuts if we know this is a dict and
/* We can take certain shortcuts if we know this is a dict and
not a dict subclass. */
not a dict subclass. */
if
(
Py_EnterRecursiveCall
(
" while pickling an object"
)
==
0
)
{
if
(
Py_EnterRecursiveCall
(
" while pickling an object"
)
)
status
=
batch_dict_exact
(
self
,
obj
)
;
goto
error
;
Py_LeaveRecursiveCall
(
);
status
=
batch_dict_exact
(
self
,
obj
);
}
Py_LeaveRecursiveCall
();
}
else
{
}
else
{
items
=
PyObject_CallMethod
(
obj
,
"items"
,
"()"
);
items
=
PyObject_CallMethod
(
obj
,
"items"
,
"()"
);
if
(
items
==
NULL
)
if
(
items
==
NULL
)
...
@@ -2516,7 +2518,12 @@ save_dict(PicklerObject *self, PyObject *obj)
...
@@ -2516,7 +2518,12 @@ save_dict(PicklerObject *self, PyObject *obj)
Py_DECREF
(
items
);
Py_DECREF
(
items
);
if
(
iter
==
NULL
)
if
(
iter
==
NULL
)
goto
error
;
goto
error
;
if
(
Py_EnterRecursiveCall
(
" while pickling an object"
))
{
Py_DECREF
(
iter
);
goto
error
;
}
status
=
batch_dict
(
self
,
iter
);
status
=
batch_dict
(
self
,
iter
);
Py_LeaveRecursiveCall
();
Py_DECREF
(
iter
);
Py_DECREF
(
iter
);
}
}
}
}
...
@@ -3044,7 +3051,7 @@ save(PicklerObject *self, PyObject *obj, int pers_save)
...
@@ -3044,7 +3051,7 @@ save(PicklerObject *self, PyObject *obj, int pers_save)
PyObject
*
reduce_value
=
NULL
;
PyObject
*
reduce_value
=
NULL
;
int
status
=
0
;
int
status
=
0
;
if
(
Py_EnterRecursiveCall
(
" while pickling an object"
)
<
0
)
if
(
Py_EnterRecursiveCall
(
" while pickling an object"
))
return
-
1
;
return
-
1
;
/* The extra pers_save argument is necessary to avoid calling save_pers()
/* The extra pers_save argument is necessary to avoid calling save_pers()
...
...
Tools/scripts/find_recursionlimit.py
Dosyayı görüntüle @
e6d4c5ba
...
@@ -77,14 +77,15 @@ def test_cpickle(_cache={}):
...
@@ -77,14 +77,15 @@ def test_cpickle(_cache={}):
except
ImportError
:
except
ImportError
:
print
(
"cannot import _pickle, skipped!"
)
print
(
"cannot import _pickle, skipped!"
)
return
return
l
=
None
k
,
l
=
None
,
None
for
n
in
itertools
.
count
():
for
n
in
itertools
.
count
():
try
:
try
:
l
=
_cache
[
n
]
l
=
_cache
[
n
]
continue
# Already tried and it works, let's save some time
continue
# Already tried and it works, let's save some time
except
KeyError
:
except
KeyError
:
for
i
in
range
(
100
):
for
i
in
range
(
100
):
l
=
[
l
]
l
=
[
k
,
l
]
k
=
{
i
:
l
}
_pickle
.
Pickler
(
io
.
BytesIO
(),
protocol
=-
1
)
.
dump
(
l
)
_pickle
.
Pickler
(
io
.
BytesIO
(),
protocol
=-
1
)
.
dump
(
l
)
_cache
[
n
]
=
l
_cache
[
n
]
=
l
...
...
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