[PATCH 5 of 5] check-code: handle py3 open divergence

Martijn Pieters mj at zopatista.com
Mon May 16 14:42:16 EDT 2016


On 16 May 2016, at 19:18, timeless <timeless at gmail.com> wrote:
> 
> So, on the py2 side of things, io.open seems to like to return
> <unicode>, whereas our stuff expects <str>.
> 
> On the py3 side of things. If I can avoid having to talk about unicode, I will.

But you could use binary mode and have `bytes` on Python 3 and `str` on Python 2. The only disadvantage is that universal line ending translation is gone, so you get `\r\n` if that's the convention in a given file.

--
Martijn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20160516/98ac6cfe/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 204 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20160516/98ac6cfe/attachment.sig>


More information about the Mercurial-devel mailing list