diff -r 4b97092aa4bd Python/random.c --- a/Python/random.c Sun Apr 27 18:02:35 2014 +0100 +++ b/Python/random.c Wed Apr 30 11:55:45 2014 +0200 @@ -15,8 +15,6 @@ static int _Py_HashSecret_Initialized = #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 void _PyRandom_Fini(void) { -#ifndef MS_WINDOWS +#ifdef MS_WINDOWS + if (hCryptProv) { + CloseHandle(hCryptProv); + hCryptProv = 0; + } +#else dev_urandom_close(); #endif }