[Python-checkins] cpython: Issue #21393: random.c: on Windows, close the hCryptProv handle at exit
victor.stinner
python-checkins at python.org
Fri May 2 22:07:29 CEST 2014
http://hg.python.org/cpython/rev/8704198680ba
changeset: 90539:8704198680ba
user: Victor Stinner <victor.stinner at gmail.com>
date: Fri May 02 22:06:44 2014 +0200
summary:
Issue #21393: random.c: on Windows, close the hCryptProv handle at exit
files:
Python/random.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/Python/random.c b/Python/random.c
--- a/Python/random.c
+++ b/Python/random.c
@@ -15,8 +15,6 @@
#endif
#ifdef MS_WINDOWS
-/* This handle is never explicitly released. Instead, the operating
- system will release it when the process terminates. */
static HCRYPTPROV hCryptProv = 0;
static int
@@ -298,7 +296,12 @@
void
_PyRandom_Fini(void)
{
-#ifndef MS_WINDOWS
+#ifdef MS_WINDOWS
+ if (hCryptProv) {
+ CloseHandle(hCryptProv);
+ hCryptProv = 0;
+ }
+#else
dev_urandom_close();
#endif
}
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list