[New-bugs-announce] [issue10071] Should not release GIL while running RegEnumValue

Hirokazu Yamamoto report at bugs.python.org
Tue Oct 12 13:43:24 CEST 2010

New submission from Hirokazu Yamamoto <ocean-city at m2.ccsnet.ne.jp>:

Currently, PC/winreg.c releases GIL while calling registry
API, but I found this in Remarks section of RegEnumValue.


> While using RegEnumValue, an application should not call any registry
> functions that might change the key being queried.

Maybe we shouldn't release GIL in PC/winreg.c? Thank you.

# I sometimes experienced crash of test_changing_value(test_winreg)
# on release27-maint. It happens when 2 threads calls PyEnumValue and
# PySetValue simultaneously. And I could stop it by following patch.
# I'll attach the stack trace of crash.

Index: PC/_winreg.c
--- PC/_winreg.c	(revision 85344)
+++ PC/_winreg.c	(working copy)
@@ -1219,7 +1219,6 @@
     while (1) {
         rc = RegEnumValue(hKey,
@@ -1228,7 +1227,6 @@
                   (BYTE *)retDataBuf,
         if (rc != ERROR_MORE_DATA)
@@ -1577,9 +1575,7 @@
         if (subKey == NULL)
             return NULL;
     rc = RegSetValue(hKey, subKey, REG_SZ, str, len+1);
     if (rc != ERROR_SUCCESS)
         return PyErr_SetFromWindowsErrWithFunction(rc, "RegSetValue");

components: Extension Modules
files: py27_test_winreg_crash_stack_trace.txt
messages: 118413
nosy: ocean-city
priority: normal
severity: normal
status: open
title: Should not release GIL while running RegEnumValue
versions: Python 2.7, Python 3.1, Python 3.2
Added file: http://bugs.python.org/file19198/py27_test_winreg_crash_stack_trace.txt

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list