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
f98a267b
Kaydet (Commit)
f98a267b
authored
Eki 24, 2009
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Manual py3k backport: [svn r74155] Issue #6242: Fix deallocator of io.StringIO and io.BytesIO
üst
5f029ce6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
6 deletions
+17
-6
test_memoryio.py
Lib/test/test_memoryio.py
+7
-0
bytesio.c
Modules/_io/bytesio.c
+4
-4
stringio.c
Modules/_io/stringio.c
+6
-2
No files found.
Lib/test/test_memoryio.py
Dosyayı görüntüle @
f98a267b
...
...
@@ -345,6 +345,13 @@ class MemoryTestMixin:
self
.
assertEqual
(
test1
(),
buf
)
self
.
assertEqual
(
test2
(),
buf
)
def
test_instance_dict_leak
(
self
):
# Test case for issue #6242.
# This will be caught by regrtest.py -R if this leak.
for
_
in
range
(
100
):
memio
=
self
.
ioclass
()
memio
.
foo
=
1
class
PyBytesIOTest
(
MemoryTestMixin
,
MemorySeekTestMixin
,
unittest
.
TestCase
):
...
...
Modules/_io/bytesio.c
Dosyayı görüntüle @
f98a267b
...
...
@@ -616,11 +616,14 @@ bytesio_close(bytesio *self)
static
void
bytesio_dealloc
(
bytesio
*
self
)
{
_PyObject_GC_UNTRACK
(
self
);
if
(
self
->
buf
!=
NULL
)
{
PyMem_Free
(
self
->
buf
);
self
->
buf
=
NULL
;
}
Py_TYPE
(
self
)
->
tp_clear
((
PyObject
*
)
self
);
Py_CLEAR
(
self
->
dict
);
if
(
self
->
weakreflist
!=
NULL
)
PyObject_ClearWeakRefs
((
PyObject
*
)
self
);
Py_TYPE
(
self
)
->
tp_free
(
self
);
}
...
...
@@ -674,7 +677,6 @@ static int
bytesio_traverse
(
bytesio
*
self
,
visitproc
visit
,
void
*
arg
)
{
Py_VISIT
(
self
->
dict
);
Py_VISIT
(
self
->
weakreflist
);
return
0
;
}
...
...
@@ -682,8 +684,6 @@ static int
bytesio_clear
(
bytesio
*
self
)
{
Py_CLEAR
(
self
->
dict
);
if
(
self
->
weakreflist
!=
NULL
)
PyObject_ClearWeakRefs
((
PyObject
*
)
self
);
return
0
;
}
...
...
Modules/_io/stringio.c
Dosyayı görüntüle @
f98a267b
...
...
@@ -515,11 +515,15 @@ static void
stringio_dealloc
(
stringio
*
self
)
{
_PyObject_GC_UNTRACK
(
self
);
self
->
ok
=
0
;
if
(
self
->
buf
)
{
PyMem_Free
(
self
->
buf
);
self
->
buf
=
NULL
;
}
Py_CLEAR
(
self
->
readnl
);
Py_CLEAR
(
self
->
writenl
);
Py_CLEAR
(
self
->
decoder
);
if
(
self
->
buf
)
PyMem_Free
(
self
->
buf
);
Py_CLEAR
(
self
->
dict
);
if
(
self
->
weakreflist
!=
NULL
)
PyObject_ClearWeakRefs
((
PyObject
*
)
self
);
Py_TYPE
(
self
)
->
tp_free
(
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