8000 gh-133036: Deprecate codecs.open by methane · Pull Request #133038 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-133036: Deprecate codecs.open #133038

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Apr 30, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix tests
  • Loading branch information
methane committed Apr 28, 2025
commit ff0d25d9d14c4a476fd44d41b05d7545eead88fe
3 changes: 2 additions & 1 deletion Lib/test/test_multibytecodec.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,8 @@ def test_bug1728403(self):
f.write(b'\xa1')
finally:
f.close()
f = codecs.open(TESTFN, encoding='cp949')
with self.assertWarns(DeprecationWarning):
f = codecs.open(TESTFN, encoding='cp949')
try:
self.assertRaises(UnicodeDecodeError, f.read, 2)
finally:
Expand Down
6 changes: 3 additions & 3 deletions Lib/test/test_sax.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# regression test for SAX 2.0
# $Id$

from xml.sax import make_parser, ContentHandler, \
SAXException, SAXReaderNotAvailable, SAXParseException
Expand Down Expand Up @@ -832,8 +831,9 @@ class StreamReaderWriterXmlgenTest(XmlgenTest, unittest.TestCase):
fname = os_helper.TESTFN + '-codecs'

def ioclass(self):
writer = codecs.open(self.fname, 'w', encoding='ascii',
errors='xmlcharrefreplace', buffering=0)
with self.assertWarns(DeprecationWarning):
writer = codecs.open(self.fname, 'w', encoding='ascii',
errors='xmlcharrefreplace', buffering=0)
def cleanup():
writer.close()
os_helper.unlink(self.fname)
Expand Down
Loading
0