Mon, Mar 21, 2016 at 11:11:51AM CET, olichtne(a)redhat.com wrote:
On Wed, Mar 16, 2016 at 03:16:43PM +0100, Jan Tluka wrote:
> Recently added SecureSocket feature brought dependency on Python 2.7
> namely bit_length() method. Since we need to keep compatibility with
> Python 2.6 that's on RHEL6 I added a fallback if bit_length is not
> available. I compared the DH_GROUP and SRP_GROUP dicts both on Python2.6
> and 2.7 and they had the same content (bit length), so this patch should
> be safe.
>
> Fixes issue 166.
>
> Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
> ---
> +def bit_length(i):
> + try:
> + int(1).bit_length()
> + except AttributeError:
> + return len(bin(i)) - 2
> +
> + return i.bit_length()
> +
Why not:
try:
return i.bit_length()
except:
return len(bin(i)) - 2
Ok, will resend with this fix.
-Jan