From 55087f0c351d6de453a5c95293792051d899f16b Mon Sep 17 00:00:00 2001 From: Jeremy Hylton Date: Mon, 29 Jan 2001 22:46:35 +0000 Subject: [PATCH] Cleanup logic a little. Check args first, then try to create the object. This avoids creation + decref if bogus arguments are passed. --- Modules/shamodule.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Modules/shamodule.c b/Modules/shamodule.c index 32ac02dbabe..8bfcec7b82b 100644 --- a/Modules/shamodule.c +++ b/Modules/shamodule.c @@ -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()) {