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
b6b1ab4f
Kaydet (Commit)
b6b1ab4f
authored
Şub 29, 2016
tarafından
Martin Panter
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #26385: Cleanup NamedTemporaryFile if fdopen() fails, by SilentGhost
üst
97b6e0bd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
1 deletion
+12
-1
tempfile.py
Lib/tempfile.py
+2
-1
test_tempfile.py
Lib/test/test_tempfile.py
+7
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/tempfile.py
Dosyayı görüntüle @
b6b1ab4f
...
@@ -476,7 +476,8 @@ def NamedTemporaryFile(mode='w+b', bufsize=-1, suffix="",
...
@@ -476,7 +476,8 @@ def NamedTemporaryFile(mode='w+b', bufsize=-1, suffix="",
try
:
try
:
file
=
_os
.
fdopen
(
fd
,
mode
,
bufsize
)
file
=
_os
.
fdopen
(
fd
,
mode
,
bufsize
)
return
_TemporaryFileWrapper
(
file
,
name
,
delete
)
return
_TemporaryFileWrapper
(
file
,
name
,
delete
)
except
:
except
BaseException
:
_os
.
unlink
(
name
)
_os
.
close
(
fd
)
_os
.
close
(
fd
)
raise
raise
...
...
Lib/test/test_tempfile.py
Dosyayı görüntüle @
b6b1ab4f
...
@@ -827,6 +827,13 @@ class test_NamedTemporaryFile(TC):
...
@@ -827,6 +827,13 @@ class test_NamedTemporaryFile(TC):
os
.
close
=
old_close
os
.
close
=
old_close
os
.
fdopen
=
old_fdopen
os
.
fdopen
=
old_fdopen
def
test_bad_mode
(
self
):
dir
=
tempfile
.
mkdtemp
()
self
.
addCleanup
(
support
.
rmtree
,
dir
)
with
self
.
assertRaises
(
TypeError
):
tempfile
.
NamedTemporaryFile
(
mode
=
(),
dir
=
dir
)
self
.
assertEqual
(
os
.
listdir
(
dir
),
[])
# How to test the mode and bufsize parameters?
# How to test the mode and bufsize parameters?
test_classes
.
append
(
test_NamedTemporaryFile
)
test_classes
.
append
(
test_NamedTemporaryFile
)
...
...
Misc/NEWS
Dosyayı görüntüle @
b6b1ab4f
...
@@ -55,6 +55,9 @@ Core and Builtins
...
@@ -55,6 +55,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #26385: Remove the file if the internal fdopen() call in
NamedTemporaryFile() fails. Based on patch by Silent Ghost.
- Issue #26309: In the "socketserver" module, shut down the request (closing
- Issue #26309: In the "socketserver" module, shut down the request (closing
the connected socket) when verify_request() returns false. Based on patch
the connected socket) when verify_request() returns false. Based on patch
by Aviv Palivoda.
by Aviv Palivoda.
...
...
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