[issue46594] Windows "Edit with IDLE >" only has one selection

Eryk Sun report at bugs.python.org
Tue Feb 1 18:48:12 EST 2022


Eryk Sun <eryksun at gmail.com> added the comment:

> the Open With entries may not be being merged.

That would probably be a bug in the Windows shell API. The HKCU and HKLM subkeys of "Software\Classes\Python.File\Shell\editwithidle\shell" are merged in the HKCR view. The same key path can exist in both hives, for which the view contains the union, with precedence for HKCU.

For example, with "Software\Classes\spam":

    import winreg

    hkm = winreg.CreateKey(winreg.HKEY_LOCAL_MACHINE, r'Software\Classes\spam')
    winreg.SetValueEx(hkm, 'eggs', 0, winreg.REG_SZ, 'hklm')
    winreg.SetValueEx(hkm, 'baz', 0, winreg.REG_SZ, 'hklm')

    hku = winreg.CreateKey(winreg.HKEY_CURRENT_USER, r'Software\Classes\spam')
    winreg.SetValueEx(hku, 'eggs', 0, winreg.REG_SZ, 'hkcu')
    winreg.SetValueEx(hku, 'bam', 0, winreg.REG_SZ, 'hkcu')

    hkr = winreg.OpenKey(winreg.HKEY_CLASSES_ROOT, 'spam')

    >>> winreg.EnumValue(hkr, 0)
    ('bam', 'hkcu', 1)
    >>> winreg.EnumValue(hkr, 1)
    ('baz', 'hklm', 1)
    >>> winreg.EnumValue(hkr, 2)
    ('eggs', 'hkcu', 1)

    >>> winreg.EnumValue(hkr, 3)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    OSError: [WinError 259] No more data is available

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46594>
_______________________________________


More information about the Python-bugs-list mailing list