summaryrefslogtreecommitdiff
path: root/Python/random.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2014-11-23 15:56:41 +0100
committerAntoine Pitrou <solipsis@pitrou.net>2014-11-23 15:56:41 +0100
commit7b53f4ba313ddc97503a1b20a32c7ece98e6f14f (patch)
treed4a1ae925557271361d6681d52110a9baab414f8 /Python/random.c
parent45d2905e417a1edcec07d77bb7a2b5e16a6d7a85 (diff)
parent86a6e9bbd9773fe387dae31f7ca24ccfcdc7ded1 (diff)
downloadcpython-7b53f4ba313ddc97503a1b20a32c7ece98e6f14f.tar.gz
Issue #22894: TestCase.subTest() would cause the test suite to be stopped when in failfast mode, even in the absence of failures.
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
}