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
4c6a020a
Kaydet (Commit)
4c6a020a
authored
Eyl 03, 2013
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #17487: The result of the wave getparams method now is pickleable again.
Patch by Claudiu Popa.
üst
c6171e49
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
3 deletions
+19
-3
test_wave.py
Lib/test/test_wave.py
+13
-0
wave.py
Lib/wave.py
+3
-3
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/test/test_wave.py
Dosyayı görüntüle @
4c6a020a
from
test.support
import
TESTFN
,
unlink
from
test.support
import
TESTFN
,
unlink
import
wave
import
wave
import
pickle
import
unittest
import
unittest
nchannels
=
2
nchannels
=
2
...
@@ -69,6 +70,18 @@ class TestWave(unittest.TestCase):
...
@@ -69,6 +70,18 @@ class TestWave(unittest.TestCase):
self
.
assertEqual
(
params
.
comptype
,
self
.
f
.
getcomptype
())
self
.
assertEqual
(
params
.
comptype
,
self
.
f
.
getcomptype
())
self
.
assertEqual
(
params
.
compname
,
self
.
f
.
getcompname
())
self
.
assertEqual
(
params
.
compname
,
self
.
f
.
getcompname
())
def
test_getparams_picklable
(
self
):
self
.
f
=
wave
.
open
(
TESTFN
,
'wb'
)
self
.
f
.
setnchannels
(
nchannels
)
self
.
f
.
setsampwidth
(
sampwidth
)
self
.
f
.
setframerate
(
framerate
)
self
.
f
.
close
()
self
.
f
=
wave
.
open
(
TESTFN
,
'rb'
)
params
=
self
.
f
.
getparams
()
dump
=
pickle
.
dumps
(
params
)
self
.
assertEqual
(
pickle
.
loads
(
dump
),
params
)
def
test_wave_write_context_manager_calls_close
(
self
):
def
test_wave_write_context_manager_calls_close
(
self
):
# Close checks for a minimum header and will raise an error
# Close checks for a minimum header and will raise an error
# if it is not set, so this proves that close is called.
# if it is not set, so this proves that close is called.
...
...
Lib/wave.py
Dosyayı görüntüle @
4c6a020a
...
@@ -87,7 +87,7 @@ import sys
...
@@ -87,7 +87,7 @@ import sys
from
chunk
import
Chunk
from
chunk
import
Chunk
from
collections
import
namedtuple
from
collections
import
namedtuple
_
result
=
namedtuple
(
'
params'
,
_
wave_params
=
namedtuple
(
'_wave_
params'
,
'nchannels sampwidth framerate nframes comptype compname'
)
'nchannels sampwidth framerate nframes comptype compname'
)
class
Wave_read
:
class
Wave_read
:
...
@@ -212,7 +212,7 @@ class Wave_read:
...
@@ -212,7 +212,7 @@ class Wave_read:
return
self
.
_compname
return
self
.
_compname
def
getparams
(
self
):
def
getparams
(
self
):
return
_
result
(
self
.
getnchannels
(),
self
.
getsampwidth
(),
return
_
wave_params
(
self
.
getnchannels
(),
self
.
getsampwidth
(),
self
.
getframerate
(),
self
.
getnframes
(),
self
.
getframerate
(),
self
.
getnframes
(),
self
.
getcomptype
(),
self
.
getcompname
())
self
.
getcomptype
(),
self
.
getcompname
())
...
@@ -410,7 +410,7 @@ class Wave_write:
...
@@ -410,7 +410,7 @@ class Wave_write:
def
getparams
(
self
):
def
getparams
(
self
):
if
not
self
.
_nchannels
or
not
self
.
_sampwidth
or
not
self
.
_framerate
:
if
not
self
.
_nchannels
or
not
self
.
_sampwidth
or
not
self
.
_framerate
:
raise
Error
(
'not all parameters set'
)
raise
Error
(
'not all parameters set'
)
return
_
result
(
self
.
_nchannels
,
self
.
_sampwidth
,
self
.
_framerate
,
return
_
wave_params
(
self
.
_nchannels
,
self
.
_sampwidth
,
self
.
_framerate
,
self
.
_nframes
,
self
.
_comptype
,
self
.
_compname
)
self
.
_nframes
,
self
.
_comptype
,
self
.
_compname
)
def
setmark
(
self
,
id
,
pos
,
name
):
def
setmark
(
self
,
id
,
pos
,
name
):
...
...
Misc/NEWS
Dosyayı görüntüle @
4c6a020a
...
@@ -54,6 +54,9 @@ Core and Builtins
...
@@ -54,6 +54,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #17487: The result of the wave getparams method now is pickleable again.
Patch by Claudiu Popa.
- Issue #18756: os.urandom() now uses a lazily-opened persistent file
- Issue #18756: os.urandom() now uses a lazily-opened persistent file
descriptor, so as to avoid using many file descriptors when run in
descriptor, so as to avoid using many file descriptors when run in
parallel from multiple threads.
parallel from multiple threads.
...
...
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