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
b4ba986a
Kaydet (Commit)
b4ba986a
authored
Eyl 10, 2010
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #9402: pyexpat uses Py_DECREF() instead of PyObject_DEL()
Fix a crash if Python is compiled in pydebug mode.
üst
3d75d0cc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
15 deletions
+27
-15
test_pyexpat.py
Lib/test/test_pyexpat.py
+19
-0
pyexpat.c
Modules/pyexpat.c
+8
-15
No files found.
Lib/test/test_pyexpat.py
Dosyayı görüntüle @
b4ba986a
...
@@ -221,6 +221,25 @@ class InterningTest(unittest.TestCase):
...
@@ -221,6 +221,25 @@ class InterningTest(unittest.TestCase):
# L should have the same string repeated over and over.
# L should have the same string repeated over and over.
self
.
assertTrue
(
tag
is
entry
)
self
.
assertTrue
(
tag
is
entry
)
def
test_issue9402
(
self
):
# create an ExternalEntityParserCreate with buffer text
class
ExternalOutputter
:
def
__init__
(
self
,
parser
):
self
.
parser
=
parser
self
.
parser_result
=
None
def
ExternalEntityRefHandler
(
self
,
context
,
base
,
sysId
,
pubId
):
external_parser
=
self
.
parser
.
ExternalEntityParserCreate
(
""
)
self
.
parser_result
=
external_parser
.
Parse
(
""
,
1
)
return
1
parser
=
expat
.
ParserCreate
(
namespace_separator
=
'!'
)
parser
.
buffer_text
=
1
out
=
ExternalOutputter
(
parser
)
parser
.
ExternalEntityRefHandler
=
out
.
ExternalEntityRefHandler
parser
.
Parse
(
data
,
1
)
self
.
assertEquals
(
out
.
parser_result
,
1
)
class
BufferTextTest
(
unittest
.
TestCase
):
class
BufferTextTest
(
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
...
...
Modules/pyexpat.c
Dosyayı görüntüle @
b4ba986a
...
@@ -973,21 +973,7 @@ xmlparse_ExternalEntityParserCreate(xmlparseobject *self, PyObject *args)
...
@@ -973,21 +973,7 @@ xmlparse_ExternalEntityParserCreate(xmlparseobject *self, PyObject *args)
return
NULL
;
return
NULL
;
new_parser
->
buffer_size
=
self
->
buffer_size
;
new_parser
->
buffer_size
=
self
->
buffer_size
;
new_parser
->
buffer_used
=
0
;
new_parser
->
buffer_used
=
0
;
if
(
self
->
buffer
!=
NULL
)
{
new_parser
->
buffer
=
NULL
;
new_parser
->
buffer
=
malloc
(
new_parser
->
buffer_size
);
if
(
new_parser
->
buffer
==
NULL
)
{
#ifndef Py_TPFLAGS_HAVE_GC
/* Code for versions 2.0 and 2.1 */
PyObject_Del
(
new_parser
);
#else
/* Code for versions 2.2 and later. */
PyObject_GC_Del
(
new_parser
);
#endif
return
PyErr_NoMemory
();
}
}
else
new_parser
->
buffer
=
NULL
;
new_parser
->
ordered_attributes
=
self
->
ordered_attributes
;
new_parser
->
ordered_attributes
=
self
->
ordered_attributes
;
new_parser
->
specified_attributes
=
self
->
specified_attributes
;
new_parser
->
specified_attributes
=
self
->
specified_attributes
;
new_parser
->
in_callback
=
0
;
new_parser
->
in_callback
=
0
;
...
@@ -1003,6 +989,13 @@ xmlparse_ExternalEntityParserCreate(xmlparseobject *self, PyObject *args)
...
@@ -1003,6 +989,13 @@ xmlparse_ExternalEntityParserCreate(xmlparseobject *self, PyObject *args)
PyObject_GC_Init
(
new_parser
);
PyObject_GC_Init
(
new_parser
);
#endif
#endif
if
(
self
->
buffer
!=
NULL
)
{
new_parser
->
buffer
=
malloc
(
new_parser
->
buffer_size
);
if
(
new_parser
->
buffer
==
NULL
)
{
Py_DECREF
(
new_parser
);
return
PyErr_NoMemory
();
}
}
if
(
!
new_parser
->
itself
)
{
if
(
!
new_parser
->
itself
)
{
Py_DECREF
(
new_parser
);
Py_DECREF
(
new_parser
);
return
PyErr_NoMemory
();
return
PyErr_NoMemory
();
...
...
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