mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
win32_urandom(): Raise ValueError if the argument is negative.
This commit is contained in:
parent
4ad8217ae9
commit
51eba6115d
1 changed files with 3 additions and 0 deletions
|
@ -7246,6 +7246,9 @@ win32_urandom(PyObject *self, PyObject *args)
|
|||
/* Read arguments */
|
||||
if (! PyArg_ParseTuple(args, "i", &howMany))
|
||||
return NULL;
|
||||
if (howMany < 0)
|
||||
return PyErr_Format(PyExc_ValueError,
|
||||
"negative argument not allowed");
|
||||
|
||||
if (hCryptProv == 0) {
|
||||
HINSTANCE hAdvAPI32 = NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue