From: SourceForge.net <no...@so...> - 2012-04-22 17:40:23
|
Bugs item #3520202, was opened at 2012-04-21 21:53 Message generated for change (Comment added) made by dkf You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112997&aid=3520202&group_id=12997 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: 83. Mac OS X Build Group: current: 8.5.11 Status: Open Resolution: None Priority: 5 Private: No Submitted By: Ned Deily () Assigned to: Kevin Walzer (wordtech) Summary: Cocoa Tk 8.5 generates invalid mouse_wheel invents Initial Comment: See details and test case at Python issue http://bugs.python.org/issue10731 It appears that, for Tcl_CreateCommand at least, mouse_wheel events are being returned with a bogus argument count value of 20, possibly the length of the valid first argument string. This causes problems in Python 3.x when _tkinter.c attempts to translate the garbage arguments strings, expecting them to be valid Unicode UTF-8 strings. ---------------------------------------------------------------------- >Comment By: Donal K. Fellows (dkf) Date: 2012-04-22 10:40 Message: I'm aware of that code. I need to know which substitution is barfing. The value of 'i' from that breakpoint (in the failing loop) is just the thing I need. ---------------------------------------------------------------------- Comment By: Ned Deily () Date: 2012-04-22 09:25 Message: I was breakpointing here which is the callback from Tcl: http://hg.python.org/cpython/file/b3a565e9701e/Modules/_tkinter.c#l2027 I *think* where the mouse_wheel event is being detected and generated within Tk is here in macosx/tkMacOSXMouseEvent.c:: http://core.tcl.tk/tk/artifact/14219b6fb35bd939a8b6228a390ca8853610005a Note the special case for NSScrollWheel event. ---------------------------------------------------------------------- Comment By: Donal K. Fellows (dkf) Date: 2012-04-22 09:10 Message: So... might be what the original report says: something not being encoded when it should've been, or being reported as one type of substitution when it is another. ---------------------------------------------------------------------- Comment By: Donal K. Fellows (dkf) Date: 2012-04-22 09:08 Message: And it's supposed to end up here: http://hg.python.org/cpython/file/b3a565e9701e/Lib/tkinter/__init__.py#l1119 ---------------------------------------------------------------------- Comment By: Donal K. Fellows (dkf) Date: 2012-04-22 09:06 Message: OK, the 20 is the number of different substitutions across all event types (+1 for the handler name). ---------------------------------------------------------------------- Comment By: Ned Deily () Date: 2012-04-22 09:05 Message: I'm not very familiar with the details of how Python and Tk are glued together. I believe Tkinter, the Python interfere to Tk, uses the Tcl C API to add a new command which is bound to all events of interest; that's how Tkinter gets called back from Tcl. There are two different interfaces for externaI C programs to register as commands; Tkinter still uses the older Tcl_CreateCommand interface. I believe the bug is in how the event callback is being set up for the mouse_wheel event. It might not be visible from a Tcl script. One way to attempt to reproduce it would be to write a simple C program that calls Tcl_CreateCommand to create a new command and then define a Tcl script that binds mouse_wheel events to it. http://www.tcl.tk/man/tcl8.5/TclLib/CrtCommand.htm ---------------------------------------------------------------------- Comment By: Donal K. Fellows (dkf) Date: 2012-04-22 08:54 Message: Poking around further, I don't know how you're causing the command in question to be invoked on a mouse event. In particular, what is the Tcl-side binding that is installed to intercept the <MouseWheel> event and transfer it across? If it is being called from Tcl or Tk, you've found a very serious bug. OTOH, there's insufficient information for me say for sure if that's what's actually happening; after all, it was always possible for code to get a command's implementation function and call it with bogus arguments (though it was also wrong). ---------------------------------------------------------------------- Comment By: Donal K. Fellows (dkf) Date: 2012-04-22 05:26 Message: I can't see any line of code in Tk which that could possibly apply to. The only commands in Tk 8.5 that use the Tcl_CreateCommand interface (apart from in our test framework) are scrollbars and [send], and it can't be the latter. Moreover, Tk doesn't think that events are commands. Please help by guiding where I ought to be looking. :-) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112997&aid=3520202&group_id=12997 |