Bug squashing.
[catacomb-python] / pubkey.c
index 9e50806..735a2c0 100644 (file)
--- a/pubkey.c
+++ b/pubkey.c
@@ -670,7 +670,9 @@ static PyObject *rsaget_rng(PyObject *me, void *hunoz)
 static int rsaset_rng(PyObject *me, PyObject *val, void *hunoz)
 {
   int rc = -1;
-  if (val != Py_None && !GRAND_PYCHECK(val))
+  if (!val)
+    val = Py_None;
+  else if (val != Py_None && !GRAND_PYCHECK(val))
     TYERR("expected grand or None");
   Py_DECREF(RSA_RNG(me));
   RSA_RNG(me) = val;