mirror of https://github.com/python/cpython
Issue #15219: Fix a reference leak when hashlib.new() is called with
invalid parameters.
This commit is contained in:
parent
45f0d9835c
commit
d958cc960f
|
@ -108,12 +108,8 @@ class HashLibTestCase(unittest.TestCase):
|
|||
_algo.islower()]))
|
||||
|
||||
def test_unknown_hash(self):
|
||||
try:
|
||||
hashlib.new('spam spam spam spam spam')
|
||||
except ValueError:
|
||||
pass
|
||||
else:
|
||||
self.assertTrue(0 == "hashlib didn't reject bogus hash name")
|
||||
self.assertRaises(ValueError, hashlib.new, 'spam spam spam spam spam')
|
||||
self.assertRaises(TypeError, hashlib.new, 1)
|
||||
|
||||
def test_get_builtin_constructor(self):
|
||||
get_builtin_constructor = hashlib.__dict__[
|
||||
|
|
|
@ -75,6 +75,9 @@ Core and Builtins
|
|||
Library
|
||||
-------
|
||||
|
||||
- Issue #15219: Fix a reference leak when hashlib.new() is called with
|
||||
invalid parameters.
|
||||
|
||||
- Issue #9559: If messages were only added, a new file is no longer
|
||||
created and renamed over the old file when flush() is called on an
|
||||
mbox, MMDF or Babyl mailbox.
|
||||
|
|
|
@ -477,6 +477,7 @@ EVP_new(PyObject *self, PyObject *args, PyObject *kwdict)
|
|||
}
|
||||
|
||||
if (!PyArg_Parse(name_obj, "s", &name)) {
|
||||
PyBuffer_Release(&view);
|
||||
PyErr_SetString(PyExc_TypeError, "name must be a string");
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue