mirror of
https://github.com/python/cpython.git
synced 2025-08-23 18:24:46 +00:00
bpo-31985: Deprecate openfp in aifc, sunau, and wave (#4344)
The openfp functions of aifp, sunau, and wave had pointed to the open function of each module since 1993 as a matter of backwards compatibility. In the case of aifc.openfp, it was both undocumented and untested. This change begins the formal deprecation of those openfp functions, with their removal coming in 3.9. This additionally adds a TODO in test_pyclbr around using aifc.openfp, though it shouldn't be changed until removal in 3.9.
This commit is contained in:
parent
5e0df74b3b
commit
9f914a01af
12 changed files with 48 additions and 6 deletions
|
@ -87,6 +87,7 @@ import struct
|
|||
import sys
|
||||
from chunk import Chunk
|
||||
from collections import namedtuple
|
||||
import warnings
|
||||
|
||||
_wave_params = namedtuple('_wave_params',
|
||||
'nchannels sampwidth framerate nframes comptype compname')
|
||||
|
@ -502,4 +503,7 @@ def open(f, mode=None):
|
|||
else:
|
||||
raise Error("mode must be 'r', 'rb', 'w', or 'wb'")
|
||||
|
||||
openfp = open # B/W compatibility
|
||||
def openfp(f, mode=None):
|
||||
warnings.warn("wave.openfp is deprecated since Python 3.7. "
|
||||
"Use wave.open instead.", DeprecationWarning, stacklevel=2)
|
||||
return open(f, mode=mode)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue