]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-133873: remove deprecated mark interface for `wave.Wave_{read,write}` objects...
authorBénédikt Tran <10796600+picnixz@users.noreply.github.com>
Thu, 15 May 2025 14:52:07 +0000 (16:52 +0200)
committerGitHub <noreply@github.com>
Thu, 15 May 2025 14:52:07 +0000 (14:52 +0000)
Doc/deprecations/pending-removal-in-3.15.rst
Doc/library/wave.rst
Doc/whatsnew/3.13.rst
Doc/whatsnew/3.15.rst
Lib/test/test_wave.py
Lib/wave.py
Misc/NEWS.d/next/Library/2025-05-11-10-28-11.gh-issue-133873.H03nov.rst [new file with mode: 0644]

index c80588b27b635a9bedc927d19ff723219bddb437..8953aedf989869223b8aed4dc98c3815e7744cac 100644 (file)
@@ -99,8 +99,7 @@ Pending removal in Python 3.15
 
 * :mod:`wave`:
 
-  * The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`,
-    and :meth:`~wave.Wave_read.getmarkers` methods of
+  * The ``getmark()``, ``setmark()`` and ``getmarkers()`` methods of
     the :class:`~wave.Wave_read` and :class:`~wave.Wave_write` classes
     have been deprecated since Python 3.13.
 
index 36c2bde87fb8fb9799105b05e042f4468304b3a0..a3f5bfd5e2f99cdc3d36c1e8594cc35f5907b72d 100644 (file)
@@ -123,26 +123,6 @@ Wave_read Objects
 
       Rewind the file pointer to the beginning of the audio stream.
 
-   The following two methods are defined for compatibility with the old :mod:`!aifc`
-   module, and don't do anything interesting.
-
-
-   .. method:: getmarkers()
-
-      Returns ``None``.
-
-      .. deprecated-removed:: 3.13 3.15
-         The method only existed for compatibility with the :mod:`!aifc` module
-         which has been removed in Python 3.13.
-
-
-   .. method:: getmark(id)
-
-      Raise an error.
-
-      .. deprecated-removed:: 3.13 3.15
-         The method only existed for compatibility with the :mod:`!aifc` module
-         which has been removed in Python 3.13.
 
    The following two methods define a term "position" which is compatible between
    them, and is otherwise implementation dependent.
index b3530f75b2fa4078f7dce759c1c5d27e34769f9d..7ae184058111d862f03edf8795b62696c2bb33ad 100644 (file)
@@ -1995,8 +1995,7 @@ New Deprecations
 
 * :mod:`wave`:
 
-  * Deprecate the :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`,
-    and :meth:`~wave.Wave_read.getmarkers` methods of
+  * Deprecate the ``getmark()``, ``setmark()`` and ``getmarkers()`` methods of
     the :class:`~wave.Wave_read` and :class:`~wave.Wave_write` classes,
     to be removed in Python 3.15.
     (Contributed by Victor Stinner in :gh:`105096`.)
index 8cf5238e6cc49a9ad0680d4a94bf34798c0697ba..14d96420f698fa6f666f2abec51073a5a1a1bf1d 100644 (file)
@@ -144,6 +144,15 @@ typing
   (Contributed by Bénédikt Tran in :gh:`133823`.)
 
 
+wave
+----
+
+* Removed the ``getmark()``, ``setmark()`` and ``getmarkers()`` methods
+  of the :class:`~wave.Wave_read` and :class:`~wave.Wave_write` classes,
+  which were deprecated since Python 3.13.
+  (Contributed by Bénédikt Tran in :gh:`133873`.)
+
+
 Porting to Python 3.15
 ======================
 
index 5e771c8de969ec6af17653a6c06b5032548426f4..6c3362857fc2ba2fec994251d6c712dca9ccc890 100644 (file)
@@ -136,32 +136,6 @@ class MiscTestCase(unittest.TestCase):
         not_exported = {'WAVE_FORMAT_PCM', 'WAVE_FORMAT_EXTENSIBLE', 'KSDATAFORMAT_SUBTYPE_PCM'}
         support.check__all__(self, wave, not_exported=not_exported)
 
-    def test_read_deprecations(self):
-        filename = support.findfile('pluck-pcm8.wav', subdir='audiodata')
-        with wave.open(filename) as reader:
-            with self.assertWarns(DeprecationWarning):
-                with self.assertRaises(wave.Error):
-                    reader.getmark('mark')
-            with self.assertWarns(DeprecationWarning):
-                self.assertIsNone(reader.getmarkers())
-
-    def test_write_deprecations(self):
-        with io.BytesIO(b'') as tmpfile:
-            with wave.open(tmpfile, 'wb') as writer:
-                writer.setnchannels(1)
-                writer.setsampwidth(1)
-                writer.setframerate(1)
-                writer.setcomptype('NONE', 'not compressed')
-
-                with self.assertWarns(DeprecationWarning):
-                    with self.assertRaises(wave.Error):
-                        writer.setmark(0, 0, 'mark')
-                with self.assertWarns(DeprecationWarning):
-                    with self.assertRaises(wave.Error):
-                        writer.getmark('mark')
-                with self.assertWarns(DeprecationWarning):
-                    self.assertIsNone(writer.getmarkers())
-
 
 class WaveLowLevelTest(unittest.TestCase):
 
index a34af244c3e22442d9db1929e7eb0b6f9cdf6e0c..929609fa52409d9f37c660120545d0b128ba47b6 100644 (file)
@@ -20,10 +20,6 @@ This returns an instance of a class with the following public methods:
                          compression type ('not compressed' linear samples)
       getparams()     -- returns a namedtuple consisting of all of the
                          above in the above order
-      getmarkers()    -- returns None (for compatibility with the
-                         old aifc module)
-      getmark(id)     -- raises an error since the mark does not
-                         exist (for compatibility with the old aifc module)
       readframes(n)   -- returns at most n frames of audio
       rewind()        -- rewind to the beginning of the audio stream
       setpos(pos)     -- seek to the specified position
@@ -341,16 +337,6 @@ class Wave_read:
                        self.getframerate(), self.getnframes(),
                        self.getcomptype(), self.getcompname())
 
-    def getmarkers(self):
-        import warnings
-        warnings._deprecated("Wave_read.getmarkers", remove=(3, 15))
-        return None
-
-    def getmark(self, id):
-        import warnings
-        warnings._deprecated("Wave_read.getmark", remove=(3, 15))
-        raise Error('no marks')
-
     def setpos(self, pos):
         if pos < 0 or pos > self._nframes:
             raise Error('position not in range')
@@ -551,21 +537,6 @@ class Wave_write:
         return _wave_params(self._nchannels, self._sampwidth, self._framerate,
               self._nframes, self._comptype, self._compname)
 
-    def setmark(self, id, pos, name):
-        import warnings
-        warnings._deprecated("Wave_write.setmark", remove=(3, 15))
-        raise Error('setmark() not supported')
-
-    def getmark(self, id):
-        import warnings
-        warnings._deprecated("Wave_write.getmark", remove=(3, 15))
-        raise Error('no marks')
-
-    def getmarkers(self):
-        import warnings
-        warnings._deprecated("Wave_write.getmarkers", remove=(3, 15))
-        return None
-
     def tell(self):
         return self._nframeswritten
 
diff --git a/Misc/NEWS.d/next/Library/2025-05-11-10-28-11.gh-issue-133873.H03nov.rst b/Misc/NEWS.d/next/Library/2025-05-11-10-28-11.gh-issue-133873.H03nov.rst
new file mode 100644 (file)
index 0000000..79f630b
--- /dev/null
@@ -0,0 +1,3 @@
+Remove the deprecated ``getmark()``, ``setmark()`` and ``getmarkers()``
+methods of the :class:`~wave.Wave_read` and :class:`~wave.Wave_write`
+classes, which were deprecated since Python 3.13. Patch by Bénédikt Tran.