~mcepl/m2crypto#120: 
Don't use int when you mean bool

Migrated from: https://gitlab.com/m2crypto/m2crypto/-/issues/120
Created by: Matěj Cepl mcepl@cepl.eu
Created at: 2016-05-15T21:32:57.438Z
Milestone: later_break_API

We have a zillion situations when the C functions return int to signal status/failure, and we just pass it by. We should either at least return bool, but most likely we should raise exception when the underlying C functions fails.

OK, this is highly controversial, because it breaks API (especially the raising exception part), but is not it The Right Thing™ in the end?

@all, what do you think?

Status
REPORTED
Submitter
~mcepl
Assigned to
No-one
Submitted
7 months ago
Updated
7 months ago
Labels
milestone-later_break_API

~mcepl 7 months ago

On 2016-05-16T08:58:14.194Z, Hubert Kario (@mention me if you need reply) wrote:

It's an API break, but I'd say that it's an API break for a good reason. The OpenSSL return codes are confusing while the exceptions are unambiguous.

We will need to bump the major version number.

~mcepl 7 months ago

On 2016-05-16T12:44:57.158Z, Matěj Cepl wrote:

Let us ruminate about it a little bit more and keep it as post-python3 change. And I am not sure whether I really believe that the major version '0' means anything. Let us call it 0.26.0 now and we will see when we get there.

(Last edited at 2016-05-16T12:47:18.818Z.)

~mcepl 7 months ago

Changed on 2016-05-16T12:47:51.876Z by Matěj Cepl:

Milestone changed to 0.26.0

~mcepl 7 months ago

On 2016-05-16T13:25:19.857Z, Hubert Kario (@mention me if you need reply) wrote:

yes, I strongly believe it's something that should be only considered after the Py3 work is mostly done

as far as the version number: http://semver.org/

And I think we need a strong indication to developers that a major thing happened, even if the API will be 99% compatible. Bumping the major version digit is such thing.

As for why: running code that handles correctly the int-return-as-error with library that does exception-as-error will lead to DoS attacks in best case.

~mcepl 7 months ago

On 2016-05-17T05:35:07.246Z, Craig Rodrigues wrote:

@all I would rather see you focus on porting m2crypto to Python3, and do not make any changes to API or ABI, even though it is tempting to do so.

~mcepl 7 months ago

On 2016-05-17T15:28:07.789Z, Thierry Parmentelat wrote:

+1 on Craig's comment

~mcepl 7 months ago

On 2016-05-18T13:08:06.722Z, Matěj Cepl wrote:

Certainly, 0.26.0 milestone should be translated as a back burner ;)

Register here or Log in to comment, or comment via email.