D1033: pycompat: define operating system constants
quark (Jun Wu)
phabricator at mercurial-scm.org
Thu Oct 12 15:19:34 EDT 2017
quark added inline comments.
INLINE COMMENTS
> spectral wrote in pycompat.py:24
> Since osname might be different (encoding or whatever) depending on python version, I think moving these after the 'if ispy3/else' block below and using something like:
>
> isdarwin = sysplatform == 'darwin'
> isposix = osname == 'posix'
> iswindows = osname == 'nt'
>
> would be better.
For encoding, Python 2 and 3 are compatible if we use `r` prefixed strings.
The `if` condition is to normalize strings to bytes for Mercurial use. In other words, I think only types that need to be "normalized" should be put under the `if` condition.
These `is*` constants have a type of `bool`, which does not need to be normalized. I think it's better to avoid code duplication.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D1033
To: quark, #hg-reviewers
Cc: spectral, mercurial-devel
More information about the Mercurial-devel
mailing list