summaryrefslogtreecommitdiff
path: root/Python/random.c
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2014-05-09 11:56:07 -0400
committerBrett Cannon <brett@python.org>2014-05-09 11:56:07 -0400
commit135281656d1569128926cd460cbdf017bb48ef74 (patch)
tree2f7f4c05b4e8e15b74922e9c57177461fe086824 /Python/random.c
parent328b2c3d974b2f98655105da3f90102f18a62fdc (diff)
parent711571d0ee1a7d54a61a85f236788b3a6fded432 (diff)
downloadcpython-135281656d1569128926cd460cbdf017bb48ef74.tar.gz
Merge for issue #21438
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
}