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
83137c2e
Kaydet (Commit)
83137c2e
authored
May 17, 2010
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #7079: Fix a possible crash when closing a file object while using
it from another thread. Patch by Daniel Stutzbach.
üst
af87f9f0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
3 deletions
+18
-3
test_file2k.py
Lib/test/test_file2k.py
+11
-1
NEWS
Misc/NEWS
+3
-0
fileobject.c
Objects/fileobject.c
+4
-2
No files found.
Lib/test/test_file2k.py
Dosyayı görüntüle @
83137c2e
...
@@ -429,6 +429,7 @@ class FileThreadingTests(unittest.TestCase):
...
@@ -429,6 +429,7 @@ class FileThreadingTests(unittest.TestCase):
self
.
_count_lock
=
threading
.
Lock
()
self
.
_count_lock
=
threading
.
Lock
()
self
.
close_count
=
0
self
.
close_count
=
0
self
.
close_success_count
=
0
self
.
close_success_count
=
0
self
.
use_buffering
=
False
def
tearDown
(
self
):
def
tearDown
(
self
):
if
self
.
f
:
if
self
.
f
:
...
@@ -443,7 +444,10 @@ class FileThreadingTests(unittest.TestCase):
...
@@ -443,7 +444,10 @@ class FileThreadingTests(unittest.TestCase):
test_support
.
threading_cleanup
(
*
self
.
_threads
)
test_support
.
threading_cleanup
(
*
self
.
_threads
)
def
_create_file
(
self
):
def
_create_file
(
self
):
self
.
f
=
open
(
self
.
filename
,
"w+"
)
if
self
.
use_buffering
:
self
.
f
=
open
(
self
.
filename
,
"w+"
,
buffering
=
1024
*
16
)
else
:
self
.
f
=
open
(
self
.
filename
,
"w+"
)
def
_close_file
(
self
):
def
_close_file
(
self
):
with
self
.
_count_lock
:
with
self
.
_count_lock
:
...
@@ -530,6 +534,12 @@ class FileThreadingTests(unittest.TestCase):
...
@@ -530,6 +534,12 @@ class FileThreadingTests(unittest.TestCase):
print
>>
self
.
f
,
''
print
>>
self
.
f
,
''
self
.
_test_close_open_io
(
io_func
)
self
.
_test_close_open_io
(
io_func
)
def
test_close_open_print_buffered
(
self
):
self
.
use_buffering
=
True
def
io_func
():
print
>>
self
.
f
,
''
self
.
_test_close_open_io
(
io_func
)
def
test_close_open_read
(
self
):
def
test_close_open_read
(
self
):
def
io_func
():
def
io_func
():
self
.
f
.
read
(
0
)
self
.
f
.
read
(
0
)
...
...
Misc/NEWS
Dosyayı görüntüle @
83137c2e
...
@@ -12,6 +12,9 @@ What's New in Python 2.7 Release Candidate 1?
...
@@ -12,6 +12,9 @@ What's New in Python 2.7 Release Candidate 1?
Core and Builtins
Core and Builtins
-----------------
-----------------
- Issue #7079: Fix a possible crash when closing a file object while using
it from another thread. Patch by Daniel Stutzbach.
Library
Library
-------
-------
...
...
Objects/fileobject.c
Dosyayı görüntüle @
83137c2e
...
@@ -649,8 +649,10 @@ static PyObject *
...
@@ -649,8 +649,10 @@ static PyObject *
file_close
(
PyFileObject
*
f
)
file_close
(
PyFileObject
*
f
)
{
{
PyObject
*
sts
=
close_the_file
(
f
);
PyObject
*
sts
=
close_the_file
(
f
);
PyMem_Free
(
f
->
f_setbuf
);
if
(
sts
)
{
f
->
f_setbuf
=
NULL
;
PyMem_Free
(
f
->
f_setbuf
);
f
->
f_setbuf
=
NULL
;
}
return
sts
;
return
sts
;
}
}
...
...
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