Boost logo

Boost-Build :

Subject: [Boost-build] Boost.Python hanging on OS X: possible solution (or at least a clue)
From: James Webber (jamestwebber_at_[hidden])
Date: 2013-02-19 19:32:03


Hello all, new Boost user here. I've been trying to get Boost.Python
working on OS X Lion (using Homebrew-installed Boost and Python)

Like many others in past*, I had a lot of trouble with the Boost.Python
tests. So I wanted to get on the record that I got things to work
correctly, and I think my solution points to what might be causing the bug.
I posted this on a couple bug-report threads as well but, having searched
for a solution for a long time, I want it to be visible.

* I know they're out there because I've read their emails to this list,
their StackOverflow questions, their bug reports...

Earlier I (and others) found that readline was emitting a weird character
when it is first imported into Python. This only happens when stdout has
been redirected, and it seems to be related to xterm.

You can demonstrate this for yourself in an OS X shell:

$ python -c "import readline"
( nothing happens )
$ python -c "import readline" > test
( test consists of ESC[?1034h )
$ TERM=linux python -c "import readline" > test
( test is empty )

While trying to figure this out, I noticed that only the tests
using doctest were failing, and doctest uses readline internally. But I
think this _particular_ bug might be a red herring--the extraneous
character isn't causing the problem with the tests.

The reason I think so is that I modified python.jam to set the TERM
variable to linux when running the tests, and it still would hang (but the
odd character went away). It doesn't make much sense for that character to
be the problem anyway--it's just weird output.

I still think something about readline is causing the bug, though. I was
able to get all the Boost Python tests to work (in /test and in
/example/quickstart) by _uninstalling_ the Homebrew-installed readline. So
if I tried to import readline in Python I got an exception (but doctest
still works, and the tests compile and run).

This strongly suggests to me that a bug in readline (or readline+Python) is
causing these tests to fail.

So, I don't have a patch or anything, but I think I have tracked down the bug
to readline. Hopefully that can point to a solution--I wouldn't know where
to start.

If there's any more diagnostic information I can provide, let me know.

- James



Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk