[issue10030] Patch for zip decryption speedup
Antoine Pitrou
report at bugs.python.org
Tue Oct 12 14:34:13 CEST 2010
Antoine Pitrou <pitrou at free.fr> added the comment:
Hello,
Some quick comments:
- the C module should be private and therefore called _zipdecrypt
- if you want to avoid API mismatch, you could give a tp_call to your C decrypter object, rather than a "decrypt" method
- you can put all initialization code in zipdecrypt_new and avoid the need for zipdecrypt_init
- it's better to use the "y*" code in PyArg_ParseTuple, rather than "s#"
- you should define your module as PY_SSIZE_T_CLEAN and use Py_ssize_t as length variables (rather than int)
- you *mustn't* change the contents of the buffer which is given you by "s#" or "y*", since that buffer is read-only (it can be a bytes object); instead, create a new bytes object using PyBytes_FromStringAndSize(NULL, length) and write into that; or, if you want a read-write buffer, use the "w*" code
----------
nosy: +pitrou
stage: -> patch review
versions: +Python 3.2 -Python 2.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10030>
_______________________________________
More information about the Python-bugs-list
mailing list