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
02eb4b0b
Kaydet (Commit)
02eb4b0b
authored
Şub 28, 2017
tarafından
INADA Naoki
Kaydeden (comit)
GitHub
Şub 28, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-29110: Fix file object leak in aifc.open (GH-356)
üst
c8e20218
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
4 deletions
+30
-4
aifc.py
Lib/aifc.py
+14
-4
test_aifc.py
Lib/test/test_aifc.py
+12
-0
NEWS
Misc/NEWS
+4
-0
No files found.
Lib/aifc.py
Dosyayı görüntüle @
02eb4b0b
...
@@ -288,6 +288,8 @@ class Aifc_read:
...
@@ -288,6 +288,8 @@ class Aifc_read:
# _ssnd_chunk -- instantiation of a chunk class for the SSND chunk
# _ssnd_chunk -- instantiation of a chunk class for the SSND chunk
# _framesize -- size of one frame in the file
# _framesize -- size of one frame in the file
_file
=
None
# Set here since __del__ checks it
def
initfp
(
self
,
file
):
def
initfp
(
self
,
file
):
self
.
_version
=
0
self
.
_version
=
0
self
.
_decomp
=
None
self
.
_decomp
=
None
...
@@ -341,10 +343,16 @@ class Aifc_read:
...
@@ -341,10 +343,16 @@ class Aifc_read:
self
.
_decomp
.
SetParams
(
params
)
self
.
_decomp
.
SetParams
(
params
)
def
__init__
(
self
,
f
):
def
__init__
(
self
,
f
):
if
type
(
f
)
==
type
(
''
):
if
isinstance
(
f
,
basestring
):
f
=
__builtin__
.
open
(
f
,
'rb'
)
f
=
__builtin__
.
open
(
f
,
'rb'
)
# else, assume it is an open file object already
try
:
self
.
initfp
(
f
)
self
.
initfp
(
f
)
except
:
f
.
close
()
raise
else
:
# assume it is an open file object already
self
.
initfp
(
f
)
#
#
# User visible methods.
# User visible methods.
...
@@ -562,8 +570,10 @@ class Aifc_write:
...
@@ -562,8 +570,10 @@ class Aifc_write:
# _datalength -- the size of the audio samples written to the header
# _datalength -- the size of the audio samples written to the header
# _datawritten -- the size of the audio samples actually written
# _datawritten -- the size of the audio samples actually written
_file
=
None
# Set here since __del__ checks it
def
__init__
(
self
,
f
):
def
__init__
(
self
,
f
):
if
type
(
f
)
==
type
(
''
):
if
isinstance
(
f
,
basestring
):
filename
=
f
filename
=
f
f
=
__builtin__
.
open
(
f
,
'wb'
)
f
=
__builtin__
.
open
(
f
,
'wb'
)
else
:
else
:
...
...
Lib/test/test_aifc.py
Dosyayı görüntüle @
02eb4b0b
...
@@ -129,6 +129,18 @@ class AifcMiscTest(audiotests.AudioTests, unittest.TestCase):
...
@@ -129,6 +129,18 @@ class AifcMiscTest(audiotests.AudioTests, unittest.TestCase):
#This file contains chunk types aifc doesn't recognize.
#This file contains chunk types aifc doesn't recognize.
self
.
f
=
aifc
.
open
(
findfile
(
'Sine-1000Hz-300ms.aif'
))
self
.
f
=
aifc
.
open
(
findfile
(
'Sine-1000Hz-300ms.aif'
))
def
test_close_opened_files_on_error
(
self
):
non_aifc_file
=
findfile
(
'pluck-pcm8.wav'
,
subdir
=
'audiodata'
)
class
Aifc
(
aifc
.
Aifc_read
):
def
__init__
(
self
):
pass
a
=
Aifc
()
with
self
.
assertRaises
(
aifc
.
Error
):
aifc
.
Aifc_read
.
__init__
(
a
,
non_aifc_file
)
self
.
assertTrue
(
a
.
_file
.
closed
)
def
test_write_markers_values
(
self
):
def
test_write_markers_values
(
self
):
fout
=
aifc
.
open
(
io
.
BytesIO
(),
'wb'
)
fout
=
aifc
.
open
(
io
.
BytesIO
(),
'wb'
)
self
.
assertEqual
(
fout
.
getmarkers
(),
None
)
self
.
assertEqual
(
fout
.
getmarkers
(),
None
)
...
...
Misc/NEWS
Dosyayı görüntüle @
02eb4b0b
...
@@ -36,6 +36,10 @@ Extension Modules
...
@@ -36,6 +36,10 @@ Extension Modules
Library
Library
-------
-------
- bpo-29110: Fix file object leak in aifc.open() when file is given as a
filesystem path and is not in valid AIFF format.
Original patch by Anthony Zhang.
- Issue #29354: Fixed inspect.getargs() for parameters which are cell
- Issue #29354: Fixed inspect.getargs() for parameters which are cell
variables.
variables.
...
...
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