Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#76 Uninitialization durring Py_EndInterpreter causes later fail

closed
nobody
None
5
2010-12-10
2010-11-26
Jim
No

This is complicated and has taken me several weeks and many hours to track down to a SWIG issue. Attached is a tar.gz file with commented code that reproduces the problem and a detailed README.txt file.

The issue is related to running Python in an embedded manner using multiple threads with multiple calls to Py_NewInterpreter/Py_EndInterpreter. The first time a call to Py_EndInterpreter is executed the SWIG modules in other interpreters become completely invalid. This seems to even be the case for the *.py generated proxies. I've been baffled by what's going on but I managed to do the following things:

1) Reproduce the problem with a test case with minimal code which is accompanying this README.
2) Verify it is not a Python bug by running this test case compiled as either a SWIG project OR with a hand coded python bridge. The handcoded python bridge works. The SWIG generated code does not.

Please see the README.txt file in the attached for more details.

This sample is meant to run on Linux and will run against SWIG 2.0.1. I have not tested it against an earlier release.

Discussion

  • Jim
    Jim
    2010-11-26

    Source code, build scripts, run script, to reprodice the problem

     
    Attachments
  • Jim
    Jim
    2010-11-26

    This was accidentally added as a feature request. Please delete it. I will be re-entering it as a Bug with a small change to the attached source code.

    My apologies.

     
  • Jim
    Jim
    2010-11-26

    • summary: Uninitialization durring Py_EndInterpreter causes later faii --> Uninitialization durring Py_EndInterpreter causes later fail
     
  • Olly Betts
    Olly Betts
    2010-12-10

    Closing as requested.

     
  • Olly Betts
    Olly Betts
    2010-12-10

    • status: open --> closed