simon-git: putty (master): Simon Tatham

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Sat Aug 31 13:24:19 BST 2019


TL;DR:
  a88eb543 mkicon.py: Use Python 3's true division mode.
  30c7fec6 mkicon.py: Work around Python 3's round() semantics.
  0f60c244 mkicon.py: Cope with Python 3's range().
  b810de5f mkicon.py: Avoid dict.has_key.
  9cb587c4 mkicon.py: Write output files as binary.
  14bef228 mkicon.py: Default to Python 3.

Repository:     https://git.tartarus.org/simon/putty.git
On the web:     https://git.tartarus.org/?p=simon/putty.git
Branch updated: master
Committer:      Simon Tatham <anakin at pobox.com>
Date:           2019-08-31 13:24:19

commit a88eb54312782067fac5e7afa63eb81ac83f69c1
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=a88eb54312782067fac5e7afa63eb81ac83f69c1;hp=40a4c6e06c6b785ee15fd5283eb0d628ddd43408
Author: Colin Watson <cjwatson at debian.org>
Date:   Fri Aug 30 13:40:28 2019 +0100

    mkicon.py: Use Python 3's true division mode.
    
    In Python 2, x/y means floor division if both x and y are ints, and true
    division otherwise: that is, 1/2 == 0.  In Python 3, x/y always means
    true division even if both x and y are ints, so 1/2 == 0.5.
    
    To prepare for porting to Python 3, change all the places that relied on
    floor division to use the more explicit // operator, and use "from
    __future__ import division" to change the / operator to use Python 3's
    semantics even in Python 2.  Both of these features have been available
    since Python 2.2.

 icons/mkicon.py | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

commit 30c7fec67ec63f389397c36e79a1b9c87d5a99d5
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=30c7fec67ec63f389397c36e79a1b9c87d5a99d5;hp=a88eb54312782067fac5e7afa63eb81ac83f69c1
Author: Colin Watson <cjwatson at debian.org>
Date:   Fri Aug 30 13:40:44 2019 +0100

    mkicon.py: Work around Python 3's round() semantics.
    
    Python 3 changed the built-in round() function to use round-to-even for
    exact half-way cases.  While this eliminates a bias away from zero and
    is thus a better choice in many cases, it's not what mkicon.py expected.
    
    Shadow the built-in with an invocation of the decimal module instead:
    this produces identical results for mkicon.py's purposes on both Python
    2 and 3.

 icons/mkicon.py | 6 ++++++
 1 file changed, 6 insertions(+)

commit 0f60c244e8d55180a52905a722a47944f5b70822
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=0f60c244e8d55180a52905a722a47944f5b70822;hp=30c7fec67ec63f389397c36e79a1b9c87d5a99d5
Author: Colin Watson <cjwatson at debian.org>
Date:   Fri Aug 30 13:40:57 2019 +0100

    mkicon.py: Cope with Python 3's range().
    
    On Python 3, range() returns an iterator, not a list.  Wrap it in list()
    when a list is needed.

 icons/mkicon.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

commit b810de5f3aff8ffd732fe97cc41f328b7fc41c2b
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=b810de5f3aff8ffd732fe97cc41f328b7fc41c2b;hp=0f60c244e8d55180a52905a722a47944f5b70822
Author: Colin Watson <cjwatson at debian.org>
Date:   Fri Aug 30 13:41:10 2019 +0100

    mkicon.py: Avoid dict.has_key.
    
    "key in dict" was introduced in Python 2.2, and the older
    "dict.has_key(key)" form was removed in Python 3.  Use the more portable
    "key in dict" form instead.

 icons/mkicon.py | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

commit 9cb587c43a71493aa6d85e8eb6ff8aaf4dcf9308
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=9cb587c43a71493aa6d85e8eb6ff8aaf4dcf9308;hp=b810de5f3aff8ffd732fe97cc41f328b7fc41c2b
Author: Colin Watson <cjwatson at debian.org>
Date:   Fri Aug 30 13:41:23 2019 +0100

    mkicon.py: Write output files as binary.
    
    In Python 3, open(path, "w") defaults to text files encoded using some
    default encoding, which of course isn't what we want for image data.
    Use open(path, "wb") instead, and adjust the write calls to use forms
    that work with Python 3.  bytes() and bytearray() are available as of
    Python 2.6.
    
    (This could be simplified to e.g. b"%c%c%c%c" % (r,g,b,a), and similarly
    avoiding the manual .encode call; but %-formatting on bytes requires
    Python 3.5, and I thought it might be better to be compatible with older
    versions of Python 3.)

 icons/mkicon.py | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

commit 14bef228b0b48c58cb887a032f97c71a6fe2b7f7
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=14bef228b0b48c58cb887a032f97c71a6fe2b7f7;hp=9cb587c43a71493aa6d85e8eb6ff8aaf4dcf9308
Author: Colin Watson <cjwatson at debian.org>
Date:   Fri Aug 30 13:41:36 2019 +0100

    mkicon.py: Default to Python 3.
    
    This allows a stock Unix build of PuTTY to work without the obsolescent
    Python 2 (Debian bug #937380).

 icons/mkicon.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



More information about the tartarus-commits mailing list