Commit 0b7824e5 authored by Jeremy Hylton's avatar Jeremy Hylton

Cleanup logic a little. Check args first, then try to create the

object.  This avoids creation + decref if bogus arguments are passed.
parent b19f1411
......@@ -491,16 +491,15 @@ SHA_new(PyObject *self, PyObject *args, PyObject *kwdict)
SHAobject *new;
unsigned char *cp = NULL;
int len;
if ((new = newSHAobject()) == NULL)
return NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwdict, "|s#:new", kwlist,
&cp, &len)) {
Py_DECREF(new);
return NULL;
}
if ((new = newSHAobject()) == NULL)
return NULL;
sha_init(new);
if (PyErr_Occurred()) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment