[Python-checkins] r42484 - python/trunk/PC/_winreg.c
tim.peters
python-checkins at python.org
Sun Feb 19 05:05:40 CET 2006
Author: tim.peters
Date: Sun Feb 19 05:05:39 2006
New Revision: 42484
Modified:
python/trunk/PC/_winreg.c
Log:
PyEnumKey(): Stop including the trailing NUL byte
in the returned string (logic error introduced by
recent patch).
Modified: python/trunk/PC/_winreg.c
==============================================================================
--- python/trunk/PC/_winreg.c (original)
+++ python/trunk/PC/_winreg.c Sun Feb 19 05:05:39 2006
@@ -832,9 +832,9 @@
void *src_buf;
PyBufferProcs *pb = value->ob_type->tp_as_buffer;
if (pb==NULL) {
- PyErr_Format(PyExc_TypeError,
+ PyErr_Format(PyExc_TypeError,
"Objects of type '%s' can not "
- "be used as binary registry values",
+ "be used as binary registry values",
value->ob_type->tp_name);
return FALSE;
}
@@ -1039,14 +1039,13 @@
return NULL;
if (!PyHKEY_AsHKEY(obKey, &hKey, FALSE))
return NULL;
-
+
Py_BEGIN_ALLOW_THREADS
rc = RegEnumKeyEx(hKey, index, tmpbuf, &len, NULL, NULL, NULL, NULL);
Py_END_ALLOW_THREADS
if (rc != ERROR_SUCCESS)
return PyErr_SetFromWindowsErrWithFunction(rc, "RegEnumKeyEx");
-
- ++len; /* include null terminator */
+
retStr = PyString_FromStringAndSize(tmpbuf, len);
return retStr; /* can be NULL */
}
More information about the Python-checkins
mailing list