[Pythonmac-SIG] A couple of universal binary questions

Bob Ippolito bob at redivi.com
Tue Jun 6 19:35:06 CEST 2006

On Jun 6, 2006, at 9:56 AM, Michael Glassford wrote:

> Bob Ippolito wrote:
>>> What's the right way to detect within the application whether its
>>> running on an Intel or a PowerPC Mac? I can figure out a way on  
>>> my own
>>> (such as looking at sys.byteorder), but I wonder if there's an
>>> "official" way.
>> The right way to detect is to not detect at all.
> I realize that's generally preferable, but...
>> Otherwise, it depends on what reason you're doing it.
> I'm experimenting with getting Psyco working in the application, and
> obviously only want to enable it if I'm running on an Intel  
> machine. It
> may turn out to do this check on its own; at the moment I can't tell,
> because enabling it automatically crashes my application on both Intel
> and PowerPC Macs.

psyco doesn't quite work on Mac OS X i386. I think it's because Mac  
OS X requires a 16 byte stack alignment, and other i386 platforms  
expect much less (4 I think) so psyco ends up misaligning the stack  
on some function calls and ends up crashing somewhat non- 
deterministically. It didn't look very easy to fix, there's a lot of  
gnarly code in psyco... someone would more or less have to ask Armin  
how to fix it.

psyco's ivm backend should work on both if it works at all, but I'm  
not sure how stable it is or how much of a performance boost it's  
going to get, and I don't think it's ever really seen any real-world  

Note that it'd be possible to simply change psyco a bit make the PPC  
part of psyco compile to a binary that raises ImportError.. which  
would alleviate any need to do platform detection.


More information about the Pythonmac-SIG mailing list