aboutsummaryrefslogtreecommitdiffstats
path: root/lang/python/pyme/core.py
diff options
context:
space:
mode:
authorJustus Winter <[email protected]>2016-05-12 15:44:54 +0000
committerJustus Winter <[email protected]>2016-05-12 15:59:21 +0000
commitf7094d8358e933f3ce074eade7a40b2a7d291180 (patch)
tree625d6172569d071629d7d6762463bc707ea4663a /lang/python/pyme/core.py
parentpython: Add a test suite. (diff)
downloadgpgme-f7094d8358e933f3ce074eade7a40b2a7d291180.tar.gz
gpgme-f7094d8358e933f3ce074eade7a40b2a7d291180.zip
python: Fix writing to data buffers.
* lang/python/gpgme.i: Add typemap for buffers. * lang/python/pyme/core.py (Data.write): Fix function. * lang/python/tests/Makefile.am: Add new test. * lang/python/tests/t-data.py: New file. Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to 'lang/python/pyme/core.py')
-rw-r--r--lang/python/pyme/core.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/lang/python/pyme/core.py b/lang/python/pyme/core.py
index e822704a..dafbd9b3 100644
--- a/lang/python/pyme/core.py
+++ b/lang/python/pyme/core.py
@@ -391,8 +391,10 @@ class Data(GpgmeWrapper):
self.new_from_fd(file)
def write(self, buffer):
- """Write buffer given as bytes."""
- errorcheck(pygpgme.gpgme_data_write(self.wrapped, buffer, len(buffer)))
+ """Write buffer given as string or bytes.
+
+ If a string is given, it is implicitly encoded using UTF-8."""
+ return pygpgme.gpgme_data_write(self.wrapped, buffer)
def read(self, size = -1):
"""Read at most size bytes, returned as bytes.