summaryrefslogtreecommitdiffstats
path: root/Lib/codecs.py
diff options
context:
space:
mode:
authorInada Naoki <songofacandy@gmail.com>2025-04-30 01:11:09 (GMT)
committerGitHub <noreply@github.com>2025-04-30 01:11:09 (GMT)
commit4e294f6feb3193854d23e0e8be487213a80b232f (patch)
tree5bd03678ff6136ef2a7ffb03a088388c275713c7 /Lib/codecs.py
parent732d1b02417e91d6a4247879e290065287cc6b51 (diff)
downloadcpython-4e294f6feb3193854d23e0e8be487213a80b232f.zip
cpython-4e294f6feb3193854d23e0e8be487213a80b232f.tar.gz
cpython-4e294f6feb3193854d23e0e8be487213a80b232f.tar.bz2
gh-133036: Deprecate codecs.open (#133038)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: Victor Stinner <vstinner@python.org>
Diffstat (limited to 'Lib/codecs.py')
-rw-r--r--Lib/codecs.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/codecs.py b/Lib/codecs.py
index e365e6c..fc38e92 100644
--- a/Lib/codecs.py
+++ b/Lib/codecs.py
@@ -884,7 +884,6 @@ class StreamRecoder:
### Shortcuts
def open(filename, mode='r', encoding=None, errors='strict', buffering=-1):
-
""" Open an encoded file using the given mode and return
a wrapped version providing transparent encoding/decoding.
@@ -912,8 +911,11 @@ def open(filename, mode='r', encoding=None, errors='strict', buffering=-1):
.encoding which allows querying the used encoding. This
attribute is only available if an encoding was specified as
parameter.
-
"""
+ import warnings
+ warnings.warn("codecs.open() is deprecated. Use open() instead.",
+ DeprecationWarning, stacklevel=2)
+
if encoding is not None and \
'b' not in mode:
# Force opening of the file in binary mode