Skip to content

Conversation

taleinat
Copy link
Contributor

@taleinat taleinat commented Sep 12, 2018

Notes:

  1. This converts four _hashlib.HASH methods, e.g. _hashlib.HASH.copy, despite them not using PyArg_Parse* argument parsing code.
  2. The #include "clinic/_hashopenssl.c.h" line had to be moved down a bit in the file to resolve a compilation issue.

https://bugs.python.org/issue20182

#include "clinic/_hashopenssl.c.h"
/*[clinic input]
module _hashlib
class _hashlib.HASH "EVPobject *" "& EVPtype"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: it is uncommon to add a space after &.

@@ -329,24 +345,37 @@ EVP_repr(EVPobject *self)
return PyUnicode_FromFormat("<%U HASH object @ %p>", self->name, self);
}

#if HASH_OBJ_CONSTRUCTOR
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this line was removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So that the doc-string would still be generated, as it is used as the class's doc-string.

The init method is still not used, since its inclusion in the PyTypeObject definition is still conditional on HASH_OBJ_CONSTRUCTOR.

_hashlib.HASH.__init__ as EVP_tp_init

name as name_obj: object
string as data_obj: object = NULL
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does passing an empty bytes object have the same effect as omitting the second argument? If yes, I suggest to use b'' as Python default.

The MD5 and SHA1 algorithms are always supported.\n");
/*[clinic input]
@classmethod
_hashlib.HASH.__new__ as EVP_new
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not _hashlib.HASH.__new__, it is _hashlib.new.

@tiran tiran requested a review from gpshead September 18, 2018 12:48
@taleinat
Copy link
Contributor Author

@serhiy-storchaka, thanks for the review! I've addressed your (excellent) comments and would be happy for another review.

@tiran tiran removed the skip news label Sep 18, 2018
@tiran
Copy link
Member

tiran commented Sep 18, 2018

I removed the skipnews label. Only trivial PRs are allowed to skip news.

@vstinner, @encukou, @serhiy-storchaka something is wrong with CODEOWNERS for the file. Any change to the hash module should be gated by @gpshead, Alex, or me.

@taleinat
Copy link
Contributor Author

taleinat commented Sep 18, 2018

something is wrong with CODEOWNERS for the file

How is **/*ssl* not picking up on these files?

Or perhaps @python/crypto-team isn't defined?

@tiran
Copy link
Member

tiran commented Sep 18, 2018

It's a mystery. @python/crypto-team exists and I'm a member.

@alex
Copy link
Member

alex commented Sep 18, 2018

Can confirm it works well enough that I got an email :D

@serhiy-storchaka
Copy link
Member

I think that the NEWS file should contain only information that is interested for end users. Refactorings and conversions to Argument Clinic are not mentioned in it.

Copy link
Member

@gpshead gpshead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the AC conversions and thanks everyone else for the already great reviews. This looks good.

@taleinat
Copy link
Contributor Author

@tiran, I'd like to re-apply the "skip news" label and merge this. Are you okay with that?

@gpshead
Copy link
Member

gpshead commented Dec 26, 2018

I've added the skip news label for you (nothing news worthy about this internal refactoring of _hashopenssl.c). This PR likely needs syncing with merge conflicts addressed before it can go in.

@taleinat
Copy link
Contributor Author

I'd gladly resolve the conflicts and merge this in.

I was waiting for @tiran to approve this; but given that @serhiy-storchaka and @gpshead have approved I guess this is good to go.

@taleinat taleinat merged commit c6c7237 into python:master Dec 27, 2018
@taleinat taleinat deleted the bpo-20182/AC_convert_hashopenssl branch December 27, 2018 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants