summaryrefslogtreecommitdiff
path: root/Python/random.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-09-14 21:18:31 +0300
committerSerhiy Storchaka <storchaka@gmail.com>2014-09-14 21:18:31 +0300
commitc1d9bb342c40ba1e7b0cf69214726d269f1d74db (patch)
treef971494fc467034d9f7ac082fc9930d76dde5764 /Python/random.c
parent8664b17c9457da72299bf05ca734b02c6cea00f1 (diff)
parentb0e630183e0663e0651c5d8fe54a15fb46699d0c (diff)
downloadcpython-c1d9bb342c40ba1e7b0cf69214726d269f1d74db.tar.gz
Issue #22384: An exception in Tkinter callback no longer crashes the program
when it is run with pythonw.exe. Documented that Tk.report_callback_exception() is purposed to be overriden in applications.
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
}