On Tue, 11 Oct 2016 18:19:23 +0100, Martijn Pieters wrote: > On 11 October 2016 at 17:50, Pierre-Yves David < > pierre-yves.da...@ens-lyon.org> wrote: > > > I'm trying to double review this (to have it move from hg-commited to > > public phase) and this is a bit too obscure for me (I assume there was much > > more context around the py3 table). Martijn can you give me a bit more > > context about what it going on here? What problem are we fixing and how is > > this the right way to do it ? > > > > This fixes open(filename, 'r'), open(filename, 'w'), etc. calls. In Python > 3, that second argument *must* be a string, you can't use bytes. > > The fix is the same as used with getattr() (where the second argument must > also always be a string); in the tokenizer, where we detect calls, if there > is something that looks like a call to open (and is not an attribute, so > the previous token is not a "." dot) then make sure that that second > argument is not converted to a `bytes` object instead. > > You can compare this to the "if fn in ('getattr', 'setattr', 'hasattr', > 'safehasattr'):" block above this change.
FWIW, the current transformer will also rewrite open(f('foo')). _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel