[issue9937] _winreg.EnumValue causes MemoryError

Hirokazu Yamamoto report at bugs.python.org
Fri Sep 24 18:56:29 CEST 2010

Hirokazu Yamamoto <ocean-city at m2.ccsnet.ne.jp> added the comment:

This happens because RegQueryInfoKeyA returns maximum value
name length not in *Ansi* characters but in *Unicode" characters.
I don't know clue why.


In multibyte environment, 2 or 3 bytes characters are
mapped to one size unicode. So usually, the length of *Ansi*
characters are larger than or equals to the length of *Unicode*
characters. If every Ansi characters are mapped to one size
Unicode, lengthes are equal, so probably this issue won't happen.

I'll attach the patch to fix this issue. But be care, this is not 
tested so densely. At least, the script to reproduce this issue
ran fine.

keywords: +patch
Added file: http://bugs.python.org/file18999/py27_winreg_EnumValue.patch

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list