mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
[3.9] bpo-29566: binhex.binhex now consitently writes MacOS 9 line endings. (GH-23059) (GH-23071)
[[bpo-29566]()]() notes that binhex.binhex uses inconsistent line endings (both Unix and MacOS9 line endings are used). This PR changes this to use the MacOS9 line endings everywhere.
(cherry picked from commit 2165cea548
)
Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
Automerge-Triggered-By: GH:ronaldoussoren
This commit is contained in:
parent
cfcb952e30
commit
3defcbac2c
3 changed files with 15 additions and 2 deletions
|
@ -48,6 +48,18 @@ class BinHexTestCase(unittest.TestCase):
|
|||
|
||||
self.assertRaises(binhex.Error, binhex.binhex, self.fname3, self.fname2)
|
||||
|
||||
def test_binhex_line_endings(self):
|
||||
# bpo-29566: Ensure the line endings are those for macOS 9
|
||||
with open(self.fname1, 'wb') as f:
|
||||
f.write(self.DATA)
|
||||
|
||||
binhex.binhex(self.fname1, self.fname2)
|
||||
|
||||
with open(self.fname2, 'rb') as fp:
|
||||
contents = fp.read()
|
||||
|
||||
self.assertNotIn(b'\n', contents)
|
||||
|
||||
def test_main():
|
||||
support.run_unittest(BinHexTestCase)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue