python: Handle slight differences between Python 2 and 3.
authorJustus Winter <justus@g10code.com>
Tue, 13 Sep 2016 08:44:14 +0000 (10:44 +0200)
committerJustus Winter <justus@g10code.com>
Tue, 13 Sep 2016 11:29:43 +0000 (13:29 +0200)
commit70a3be27a509a1b5ea7372bee93d83c5019427ff
tree26424006293c90a51baec2276c633850fa2f539b
parent4abff7d750a1abf5b388a4c87ec321fc3e4aed10
python: Handle slight differences between Python 2 and 3.

* lang/python/helpers.c (pyDataWriteCb): Handle Python integers being
returned on Python 2.
(pyDataSeekCb): Likewise.
* lang/python/pyme/core.py (Data.__init__): Fix testing for string
argument.
(Data.new_from_filepart): Likewise.
* lang/python/pyme/util.py (is_a_string): New function.
* lang/python/tests/t-encrypt-large.py (read_cb): Force evaluation of
generator.
* lang/python/tests/t-idiomatic.py: Partly skip test on Python 2.
* lang/python/tests/t-verify.py (check_result): Here, the difference
between 2 and 3 really matters.  We cannot change the char *
conversion in Python 2 without breaking all existing applications, and
using bytestrings in Python 3 would be very inconvenient.

Signed-off-by: Justus Winter <justus@g10code.com>
lang/python/helpers.c
lang/python/pyme/core.py
lang/python/pyme/util.py
lang/python/tests/t-encrypt-large.py
lang/python/tests/t-idiomatic.py
lang/python/tests/t-verify.py