+static PyObject *gcshakyrand_pynew(PyTypeObject *ty,
+ PyObject *arg, PyObject *kw)
+{
+ const gccrand_info *info = GCCRAND_INFO(ty);
+ static char *kwlist_shake[] = { "key", "func", "perso", 0 };
+ static char *kwlist_func[] = { "key", "perso", 0 };
+ char *k, *f = 0, *p = 0;
+ Py_ssize_t ksz, fsz = 0, psz = 0;
+
+ if ((info->f&RNGF_MASK) == RNG_SHAKE
+ ? !PyArg_ParseTupleAndKeywords(arg, kw, "s#|s#s#:new", kwlist_shake,
+ &k, &ksz, &f, &fsz, &p, &psz)
+ : !PyArg_ParseTupleAndKeywords(arg, kw, "s#|s#:new", kwlist_func,
+ &k, &ksz, &p, &psz))
+ goto end;
+ if (keysz(ksz, info->keysz) != ksz) VALERR("bad key length");
+ return (grand_dopywrap(ty,
+ (info->f&RNGF_MASK) == RNG_SHAKE
+ ? ((gcshakerand_func *)info->func)(f, fsz,
+ p, psz,
+ k, ksz)
+ : ((gcshafuncrand_func *)info->func)(p, psz,
+ k, ksz),
+ f_freeme));
+end:
+ return (0);
+}
+