Message78317
New version of ebfe's patch:
- ENTER/LEAVE_HASHLIB:
* don't touch GIL in ENTER_HASHLIB (it's useless)
* add mandatory argument (explicit use of "self")
- EVP_hash():
* restore Py_SAFE_DOWNCAST
* simplify the code: always use the while() instead of if+while
* use "while (0 < len)" to skip zero or negative value (even if
pitrou told me that len should not be negative)
- EVP_dealloc(): free the lock before the context
- release the GIL for all calls to EVP_hash()
- use the context lock in EVP_copy() and EVP_get_digest_size() to
protect self
- don't use the context lock in EVP_repr() (useless because we don't
read OpenSSL context)
- fix the indentation of the code (replace tab by spaces)
Some rules for ENTER/LEAVE_HASHLIB:
* it is only needed to protect the context attribute (eg. name
doesn't need to be protected by the lock)
* it doesn't touch the GIL: use an explicit call to
Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS
About the GIL:
* EVP_DigestInit() and EVP_MD_CTX_copy() are consired fast enough to
no release the GIL
* The GIL is released for the slowest function: EVP_DigestUpdate()
(called in our EVP_hash() function) |
|
Date |
User |
Action |
Args |
2008-12-26 23:18:30 | vstinner | set | recipients:
+ vstinner, pitrou, ebfe |
2008-12-26 23:18:30 | vstinner | set | messageid: <1230333510.54.0.191043591997.issue4751@psf.upfronthosting.co.za> |
2008-12-26 23:18:29 | vstinner | link | issue4751 messages |
2008-12-26 23:18:29 | vstinner | create | |
|