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
85add478
Kaydet (Commit)
85add478
authored
Ara 21, 2016
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #28871: Fixed a crash when deallocate deep ElementTree.
Fixed running MiscTests in test_xml_etree_c.
üst
6b1c909c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
4 deletions
+32
-4
test_xml_etree_c.py
Lib/test/test_xml_etree_c.py
+11
-0
NEWS
Misc/NEWS
+2
-0
_elementtree.c
Modules/_elementtree.c
+19
-4
No files found.
Lib/test/test_xml_etree_c.py
Dosyayı görüntüle @
85add478
...
...
@@ -17,6 +17,7 @@ def sanity():
"""
@unittest.skipUnless
(
cET
,
'requires _elementtree'
)
class
MiscTests
(
unittest
.
TestCase
):
# Issue #8651.
@precisionbigmemtest
(
size
=
_2G
+
100
,
memuse
=
1
)
...
...
@@ -62,12 +63,22 @@ class MiscTests(unittest.TestCase):
del
element
.
attrib
self
.
assertEqual
(
element
.
attrib
,
{
'A'
:
'B'
,
'C'
:
'D'
})
def
test_trashcan
(
self
):
# If this test fails, it will most likely die via segfault.
e
=
root
=
cET
.
Element
(
'root'
)
for
i
in
range
(
200000
):
e
=
cET
.
SubElement
(
e
,
'x'
)
del
e
del
root
test_support
.
gc_collect
()
def
test_main
():
from
test
import
test_xml_etree
,
test_xml_etree_c
# Run the tests specific to the C implementation
test_support
.
run_doctest
(
test_xml_etree_c
,
verbosity
=
True
)
test_support
.
run_unittest
(
MiscTests
)
# Assign the C implementation before running the doctests
# Patch the __name__, to prevent confusion with the pure Python test
...
...
Misc/NEWS
Dosyayı görüntüle @
85add478
...
...
@@ -18,6 +18,8 @@ Library
- Issue #29019: Fix dict.fromkeys(x) overallocates when x is sparce dict.
Original patch by Rasmus Villemoes.
- Issue #28871: Fixed a crash when deallocate deep ElementTree.
- Issue #19542: Fix bugs in WeakValueDictionary.setdefault() and
WeakValueDictionary.pop() when a GC collection happens in another
thread.
...
...
Modules/_elementtree.c
Dosyayı görüntüle @
85add478
...
...
@@ -121,6 +121,18 @@ typedef int Py_ssize_t;
#define JOIN_SET(p, flag) ((void*) ((Py_uintptr_t) (JOIN_OBJ(p)) | (flag)))
#define JOIN_OBJ(p) ((PyObject*) ((Py_uintptr_t) (p) & ~1))
/* Py_CLEAR for a PyObject* that uses a join flag. Pass the pointer by
* reference since this function sets it to NULL.
*/
static
void
_clear_joined_ptr
(
PyObject
**
p
)
{
if
(
*
p
)
{
PyObject
*
tmp
=
JOIN_OBJ
(
*
p
);
*
p
=
NULL
;
Py_DECREF
(
tmp
);
}
}
/* glue functions (see the init function for details) */
static
PyObject
*
elementtree_parseerror_obj
;
static
PyObject
*
elementtree_copyelement_obj
;
...
...
@@ -538,17 +550,20 @@ subelement(PyObject* self, PyObject* args, PyObject* kw)
static
void
element_dealloc
(
ElementObject
*
self
)
{
if
(
self
->
extra
)
element_dealloc_extra
(
self
);
Py_TRASHCAN_SAFE_BEGIN
(
self
)
/* discard attributes */
Py_DECREF
(
self
->
tag
);
Py_DECREF
(
JOIN_OBJ
(
self
->
text
));
Py_DECREF
(
JOIN_OBJ
(
self
->
tail
));
_clear_joined_ptr
(
&
self
->
text
);
_clear_joined_ptr
(
&
self
->
tail
);
if
(
self
->
extra
)
element_dealloc_extra
(
self
);
RELEASE
(
sizeof
(
ElementObject
),
"destroy element"
);
PyObject_Del
(
self
);
Py_TRASHCAN_SAFE_END
(
self
)
}
/* -------------------------------------------------------------------- */
...
...
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