Re: [Pyobjc-dev] NSAnyEventMask depythonifies as int, not uint in pyobjc2
Brought to you by:
ronaldoussoren
|
From: Ronald O. <ron...@ma...> - 2007-11-21 09:11:33
|
On Wednesday, November 21, 2007, at 02:11AM, "Barry Wark" <bar...@gm...> wrote: >I'm not tracking the pyobjc2 sources very closely, so forgive me if >this has already been fixed.... > >I noticed that the PyInterpreter example from pyobjc2 no longer works >in pyobjc2. It appears that NSAnyEventMask (imported from AppKit) >depythonifies as -1 (type int) rather than an unsigned int, thus >causing an exception when it's used as a parameter to >NSApplication.nextEventMatchingMask_untilDate_inMode_dequeue_. > >Changing NSAnyEventMask to 0xffffffff (its definition, per the docs) >appears to solve the problem. Is this a BridgeSupport issue? This is a bridgesupport issue, but one that could be worked around. Or rather, it is misuse of enums by some Apple engineers (not that they are the only ones doing this): NSAnyEventMask is defined inside an enum and is therefore a signed integer, not an unsigned one as the author of that code obviously whishes it to be. This is not a problem in (Objective-)C because NSAnyEventMask is automaticly casted to an unsigned integer when needed. BTW. NSAnyEventMask is not 0xFFFFFFFF, but NSUIntegerMax, which has a different value on 64-bit builds. Ronald > >Barry > >------------------------------------------------------------------------- >This SF.net email is sponsored by: Microsoft >Defy all challenges. Microsoft(R) Visual Studio 2005. >http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >_______________________________________________ >Pyobjc-dev mailing list >Pyo...@li... >https://lists.sourceforge.net/lists/listinfo/pyobjc-dev > > |