Shashank <shashank.sunny.si...@gmail.com> added the comment:

>the C module should be private and therefore called _zipdecrypt
done

>if you want to avoid API mismatch, you could give a tp_call to your C 
>>decrypter object, rather than a "decrypt" method
done

>- you can put all initialization code in zipdecrypt_new and avoid the >need 
>for zipdecrypt_init
keeping this similar to the existing _ZipDecrypter class in ZipFile (all 
initialization in init rather than new), which was probably to allow re-init 
and re-use of one instance

>it's better to use the "y*" code in PyArg_ParseTuple, rather than "s#"
y* does not seem to be available in 2.7, using s* instead

>you should define your module as PY_SSIZE_T_CLEAN and use Py_ssize_t >as 
>length variables (rather than int)
done

>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
corrected, not altering the input buffer, reading input buffer as s*

----------
Added file: http://bugs.python.org/file19347/zipdecrypt.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10030>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to