summaryrefslogtreecommitdiff
path: root/Python/random.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2014-09-13 01:45:50 -0400
committerBenjamin Peterson <benjamin@python.org>2014-09-13 01:45:50 -0400
commit0675102eeb39b5bf471af40e8af6729102fccc6b (patch)
tree30165ba711d7216908c6c09f925957551e22f9f6 /Python/random.c
parent76b535066e42ee3d95502dd99ebbc6a05e7fdd87 (diff)
parent2fa00f40169bd7f8c5881a0aeb857d0a847f9017 (diff)
downloadcpython-0675102eeb39b5bf471af40e8af6729102fccc6b.tar.gz
merge 3.4
Diffstat (limited to 'Python/random.c')
-rw-r--r--Python/random.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/Python/random.c b/Python/random.c
index 2941ba16af..a052b65725 100644
--- a/Python/random.c
+++ b/Python/random.c
@@ -15,8 +15,6 @@ static int _Py_HashSecret_Initialized = 0;
#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 @@ _PyRandom_Init(void)
void
_PyRandom_Fini(void)
{
-#ifndef MS_WINDOWS
+#ifdef MS_WINDOWS
+ if (hCryptProv) {
+ CryptReleaseContext(hCryptProv, 0);
+ hCryptProv = 0;
+ }
+#else
dev_urandom_close();
#endif
}