[Python-bugs-list] PythonWin crash on dead keys (PR#372)

Mark Hammond mhammond@skippinet.com.au
Wed, 28 Jun 2000 10:33:26 +1000


Thanks for reporting this.  Ill look into it.

In general, this bug mechanism is for Python itself, and not the Python for
Win32 extensions.  Its probably best to simply mail future bugs in the
Win32 stuff directly to me.

Mark.

> -----Original Message-----
> From: python-bugs-list-admin@python.org
> [mailto:python-bugs-list-admin@python.org]On Behalf Of
> gottfried.ganssauge@dynix.de
> Sent: Tuesday, 27 June 2000 11:08 PM
> To: python-bugs-list@python.org
> Cc: bugs-py@python.org
> Subject: [Python-bugs-list] PythonWin crash on dead keys (PR#372)
>
>
> Full_Name: Gottfried Ganßauge
> Version: 1.5.2
> OS: Windows 2000
> Submission from: joshua2go.dynix.de (195.21.130.43)
>
>
> I'm using PyWin32 build 132, but the problem occurs with build
> 129 as well.
>
> Every time I hit one of the dead keys on my keyboard (`, ^)
> PythonWin crashes.
> I traced the error back to the routine ui_translate_vk() in
> win32uimodule.cpp.
> The call to ToAsciiEx() with a dead key's scan code returns -1 and in the
> following call to PyString_FromStringAndSize() this eventually
> leads to the
> crash.
> In my opininion the reason for that lies before the call to this routine.
> pywin hooks WM_KEYDOWN in several places and doesn't check for
> dead keys but
> tries to translate the scan code to an ASCII character.
> With dead keys this obviously must fail.
> Windows itself already does the correct translation as described in the
> Platform SDK article about Dead-Character Messages:
> <Quote on>
> Some non-English keyboards contain character keys that are not
> expected to
> produce characters by themselves. Instead, they are used to add
> a diacritic to
> the character produced by the subsequent keystroke. These keys
> are called dead
> keys. The circumflex key on a German keyboard is an example of a
> dead key. To
> enter the character consisting of an "o" with a circumflex, a
> German user would
> type the circumflex key followed by the "o" key. The window with
> the keyboard
> focus would receive the following sequence of messages:
>
> WM_KEYDOWN
> WM_DEADCHAR
> WM_KEYUP
> WM_KEYDOWN
> WM_CHAR
> WM_KEYUP
> <Quote off>
>
> Consequently pywin should ignore WM_KEYDOWN messages completely
> if they are
> produced by a dead key.
> I tried to implement that using the current win32api implementation, but
> unfortunately the necessary API-Function to find out if a key is
> a dead key are
> not provided in the current implementation; namely the MapVirtualKey(Ex)
> function.
>
> Cheers, and keep up the good work
>
> Gottfried
>
>
>
> _______________________________________________
> Python-bugs-list maillist  -  Python-bugs-list@python.org
> http://www.python.org/mailman/listinfo/python-bugs-list
>