mirror of https://github.com/python/cpython
Cleanup logic a little. Check args first, then try to create the
object. This avoids creation + decref if bogus arguments are passed.
This commit is contained in:
parent
2fdfadf6dd
commit
55087f0c35
|
@ -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()) {
|
||||
|
|
Loading…
Reference in New Issue