D299: pycompat: introduce a wrapper for __builtins__.{raw_,}input()

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Fri Aug 11 15:52:17 EDT 2017


durin42 marked an inline comment as done.
durin42 added inline comments.

INLINE COMMENTS

> yuja wrote in pycompat.py:84
> Needs to specify encoding because user input may contain
> non-ascii characters.
> 
> Perhaps it should be `noclosetextio(s, encoding=encoding.encoding)` and
> `encoding.strtolocal(input(...))`.
> Alternatively, forcing `latin-1` might work, but I'm not sure.

Ugh, gross. I can't use encoding from pycompat, can I?

> yuja wrote in ui.py:1222
> I think it's better to specify input and output explicitly.
> 
> `bytesinput(..., self.fin, self.fout)`
> 
> Setting BytesIO to `sys.stdin/stdout` is just plain wrong on Python 3.

Yeah, it's pretty clowny.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D299

To: durin42, #hg-reviewers
Cc: yuja, mercurial-devel


More information about the Mercurial-devel mailing list