From 9f914a01affc55abe799afc521ce71612bb495a5 Mon Sep 17 00:00:00 2001 From: Brian Curtin Date: Fri, 10 Nov 2017 11:38:25 -0500 Subject: 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. --- Lib/sunau.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Lib/sunau.py') diff --git a/Lib/sunau.py b/Lib/sunau.py index 0473e9e4ca..dbad3db839 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', 'nchannels sampwidth framerate nframes comptype compname') @@ -522,4 +523,7 @@ def open(f, mode=None): else: raise Error("mode must be 'r', 'rb', 'w', or 'wb'") -openfp = open +def openfp(f, mode=None): + warnings.warn("sunau.openfp is deprecated since Python 3.7. " + "Use sunau.open instead.", DeprecationWarning, stacklevel=2) + return open(f, mode=mode) -- cgit v1.2.1