diff options
author | Ned Deily <nad@acm.org> | 2014-09-13 23:40:27 -0700 |
---|---|---|
committer | Ned Deily <nad@acm.org> | 2014-09-13 23:40:27 -0700 |
commit | 4278e8cf357c7418651ca0e23346b2ddec74edce (patch) | |
tree | a3c23ca1ef525340d98e01bb53fc9e6785ce45ff /Python/random.c | |
parent | 0d48f974662035c14912d225b71b6cf93b621bb0 (diff) | |
parent | 0675102eeb39b5bf471af40e8af6729102fccc6b (diff) | |
download | cpython-4278e8cf357c7418651ca0e23346b2ddec74edce.tar.gz |
Issue #22168: Prevent turtle AttributeError with non-default Canvas on OS X.
Diffstat (limited to 'Python/random.c')
-rw-r--r-- | Python/random.c | 9 |
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 } |