b6fccf5
--- pygpgme-0.1/src/pygpgme-context.c~  2008-11-06 15:33:57.000000000 +0100
b6fccf5
+++ pygpgme-0.1/src/pygpgme-context.c   2008-11-06 15:35:35.000000000 +0100
b6fccf5
@@ -468,25 +468,29 @@
b6fccf5
                           &py_plain, &py_cipher))
b6fccf5
         return NULL;
b6fccf5
 
b6fccf5
-    py_recp = PySequence_Fast(py_recp, "first argument must be a sequence");
b6fccf5
-    if (py_recp == NULL)
b6fccf5
-        return NULL;
b6fccf5
+    if (py_recp == Py_None)
b6fccf5
+        recp = NULL;
b6fccf5
+    else {
b6fccf5
+        py_recp = PySequence_Fast(py_recp, "first argument must be a sequence");
b6fccf5
+        if (py_recp == NULL)
b6fccf5
+            return NULL;
b6fccf5
 
b6fccf5
-    length = PySequence_Fast_GET_SIZE(py_recp);
b6fccf5
-    recp = malloc((length + 1) * sizeof (gpgme_key_t));
b6fccf5
-    for (i = 0; i < length; i++) {
b6fccf5
-        PyObject *item = PySequence_Fast_GET_ITEM(py_recp, i);
b6fccf5
+        length = PySequence_Fast_GET_SIZE(py_recp);
b6fccf5
+        recp = malloc((length + 1) * sizeof (gpgme_key_t));
b6fccf5
+        for (i = 0; i < length; i++) {
b6fccf5
+            PyObject *item = PySequence_Fast_GET_ITEM(py_recp, i);
b6fccf5
 
b6fccf5
-        if (!PyObject_TypeCheck(item, &PyGpgmeKey_Type)) {
b6fccf5
-            free(recp);
b6fccf5
-            Py_DECREF(py_recp);
b6fccf5
-            PyErr_SetString(PyExc_TypeError, "items in first argument must "
b6fccf5
-                            "be gpgme.Key objects");
b6fccf5
-            return NULL;
b6fccf5
+            if (!PyObject_TypeCheck(item, &PyGpgmeKey_Type)) {
b6fccf5
+                free(recp);
b6fccf5
+                Py_DECREF(py_recp);
b6fccf5
+                PyErr_SetString(PyExc_TypeError, "items in first argument must "
b6fccf5
+                                "be gpgme.Key objects");
b6fccf5
+                return NULL;
b6fccf5
+            }
b6fccf5
+            recp[i] = ((PyGpgmeKey *)item)->key;
b6fccf5
         }
b6fccf5
-        recp[i] = ((PyGpgmeKey *)item)->key;
b6fccf5
+        recp[i] = NULL;
b6fccf5
     }
b6fccf5
-    recp[i] = NULL;
b6fccf5
 
b6fccf5
     if (pygpgme_data_new(&plain, py_plain)) {
b6fccf5
         free(recp);
b6fccf5