summaryrefslogtreecommitdiffstats
path: root/Lib/sunau.py
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2022-04-07 19:27:35 (GMT)
committerGitHub <noreply@github.com>2022-04-07 19:27:35 (GMT)
commit87eec70d97b250f820325b4f1b4f781b443b5180 (patch)
treef8e20384e332b2c5743c134d87a82070cee87ff7 /Lib/sunau.py
parent1df4298b62fcc124ba9de861f8dc8239ad72cde2 (diff)
downloadcpython-87eec70d97b250f820325b4f1b4f781b443b5180.zip
cpython-87eec70d97b250f820325b4f1b4f781b443b5180.tar.gz
cpython-87eec70d97b250f820325b4f1b4f781b443b5180.tar.bz2
Deprecate audioop (GH-32392)
Diffstat (limited to 'Lib/sunau.py')
-rw-r--r--Lib/sunau.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/sunau.py b/Lib/sunau.py
index 79750a9..9b3533d 100644
--- a/Lib/sunau.py
+++ b/Lib/sunau.py
@@ -104,6 +104,7 @@ is destroyed.
"""
from collections import namedtuple
+import warnings
_sunau_params = namedtuple('_sunau_params',
@@ -275,7 +276,9 @@ class Au_read:
data = self._file.read(nframes * self._framesize)
self._soundpos += len(data) // self._framesize
if self._encoding == AUDIO_FILE_ENCODING_MULAW_8:
- import audioop
+ with warnings.catch_warnings():
+ warnings.simplefilter('ignore', category=DeprecationWarning)
+ import audioop
data = audioop.ulaw2lin(data, self._sampwidth)
return data
return None # XXX--not implemented yet
@@ -421,7 +424,9 @@ class Au_write:
data = memoryview(data).cast('B')
self._ensure_header_written()
if self._comptype == 'ULAW':
- import audioop
+ with warnings.catch_warnings():
+ warnings.simplefilter('ignore', category=DeprecationWarning)
+ import audioop
data = audioop.lin2ulaw(data, self._sampwidth)
nframes = len(data) // self._framesize
self._file.write(data)