[Pythonmac-SIG] Mac OS X Python 2.2a4 Bug (_not_ Mac Python)

Jonathan Wight jwight_lists@mac.com
Sun, 07 Oct 2001 14:59:07 -0500


Hey Jack,

On 10/5/01 6:55 AM, "Jack Jansen" <jack@oratrix.nl> wrote:

> Recently, Jonathan Wight <jwight_lists@mac.com> said:
>> I've downloaded and compiled the latest version of ('Unix') Python (2.2a4)
>> on a Mac OS X 10.1 (5G64) and have discovered a rather serious bug.
>> 
>> Basically you cannot have more than one version of Python running at any
>> time. Try it. From Terminal.app you can launch one copy but when launching
>> the second you get a Bus Error. Every time.
> 
> I just tried this on 10.0.4 and there it works fine. So either it is a
> problem with 10.1 (which I'll install some time next week, hopefully)
> or it is a problem with your setup. Could you try starting the pythons
> with -vv and/or under gdb and/or with the dyld debugging turned on to
> see where exactly the problem occurs?

Will do (I've seen this behaviour on 2 machines running 5G64 so far).

I have a totally fresh Mac OS X 10.1 (5G64) box (seems all my Macs have
become boxes now that I run a unix on 'em) here right now and am doing a
make from scratch. Okay, got a fresh build now.

When I run python.exe (configured with '--with-suffix=.exe' only) twice I
still get the bus error. When I run with DYLD_PREBIND_DEBUG set I still get
the bus error and both instances of Python print out "dyld: 47 two-level
prebound libraries used out of 47" before any other output.

If I run python with the -vv flag I get lots of info on the first instance
of python and absolutely nothin on the second instance - the bus error is
the first thing (aside from the dyld line) output.

>> Also - if you login to Mac OS X via the console it is impossible to launch
>> an interactive Python session (and probably impossible to just launch
>> oneshot scripts too). When I try I get the following console errors:
>> 
>> KCGErrorFailure: CGSNewConnection cannot connect to server
>> KCGErrorFailure: CGSNewConnection cannot connect to server
>> KCGErrorInvalidConnection: CGSGetEventPort: Invalid connection
> 
> Again, on my 10.0.4 there's no problem, even in a Python with toolbox
> support. I get this message only as soon as I start actually importing
> Carbon modules. You didn't incidentally change your site.py or
> sitecustomize.py to import macfsn or some such (I had that originally,
> I had to revert to the distribution state to be able to run Python in
> console mode)?

Nope in all cases these are plain Pythons. Download, configure, make &
install. No tinkering anywhere.

I received one e-mail from someone else who is seeing this problem (but
didn't see the previous one).

>> I'd really like to see Python for Mac OS X (not Jack's Mac Python) be a pure
>> unix implementation of Python with any Mac specific stuff in shared
>> libraries. I would have assumed this would have been the case but it doesn't
>> look like it is.
> 
> I am unsure about this. Originally I thought that I would also want
> that, i.e. have Python be completely untainted by any MacPython stuff,
> but when I put in the few hooks (mactoolboxglue.c only, really) it
> appeared to have absolutely no detrimental effects. And for me it
> still doesn't (yet:-).
> 
> If we can get command line Python to work consistently for unix work
> with the few hooks left in I would now prefer that setup. The hooks
> have to be shared by all Carbon modules, they contain the glue code
> and some common things like an exception, and while they could
> conceivable be put into another shared library shared between the
> Carbon modules this would make the whole architecture more hairy
> again.

If I try to compile Python with the '--without-toolbox-glue' flag set I get
exactly the same results. I found that the 'without-toolbox-glue' flag isn't
used at all in the configure script and that the flag should actually be
'disable-toolbox-glue'. Doing a grep of the configure script proves this:

[localhost:~/Desktop/Python-2.2a4] schwa% grep toolbox-glue configure
  --enable-toolbox-glue            disable/enable MacOSX glue code for
extensions"
echo $ac_n "checking for --enable-toolbox-glue""... $ac_c" 1>&6
echo "configure:2932: checking for --enable-toolbox-glue" >&5
# Check whether --enable-toolbox-glue or --disable-toolbox-glue was given.

So either the readme is wrong (it mentions --without-toolbox-glue explicity)
or the configure script/makefiles need to be fixed.

If I do compile python with --disable-toolbox-glue then I get a link error
in a library (it fails to find gestalt and a PuMac_XXX function). But I can
successfully run the binary it produces multiple times from the Terminal.app
and in a GUI-less session...

Here's the error I get when I build with --disable-toolbox-glue:

skipping 'gestalt' extension (up-to-date)
dyld: ./python.exe Undefined symbols:
_Gestalt
_PyMac_Error
make: *** [sharedmods] Error 67

    Jon.