On Tue, Jun 18, 2024 at 2:19 AM Eryk Sun <eryk...@gmail.com> wrote:
>
>
>     def set_clipboard_text(text):
>         hMem = global_alloc_text(text)
>         try:
>             win32clipboard.SetClipboardData(win32clipboard.CF_UNICODETEXT,
>                                             hMem)
>             # Now the system owns the global memory.
>         except:
>             kernel32.GlobalFree(hMem)

Oops, that suppresses the exception. Fixed:

    def set_clipboard_text(text):
        hMem = global_alloc_from_text(text)
        try:
            win32clipboard.SetClipboardData(win32clipboard.CF_UNICODETEXT,
                                            hMem)
            # Now the system owns the global memory.
        except:
            kernel32.GlobalFree(hMem)
            raise
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to