reason=None;if;elif;assert reason is not None;return? #onaphonesorry


On 9 April 2014 20:44:21 Paul Kehrer <notifications@github.com> wrote:

> > @@ -842,9 +842,17 @@ def _finalize_pkey_ctx(self, evp_pkey, pkey_size, 
> evp_md):
> >              errors = self._backend._consume_errors()
> >              assert errors[0].lib == self._backend._lib.ERR_LIB_RSA
> >              assert (errors[0].reason ==
> > -                    self._backend._lib.RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE)
> > -            raise ValueError("Salt length too long for key size. Try using "
> > -                             "MAX_LENGTH instead.")
> > +                    self._backend._lib.RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE or
> > +                    errors[0].reason ==
> > +                    self._backend._lib.RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY)
> > +            if (errors[0].reason ==
> > +                    self._backend._lib.RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE):
> > +                reason = ("Salt length too long for key size. Try using "
> > +                          "MAX_LENGTH instead.")
> > +            if (errors[0].reason ==
>
> I can switch to elif, but it will result in an (apparent) branch miss 
> although that branch would be unreachable due to the assert.
>
> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/pyca/cryptography/pull/840/files#r11455091