[C++-sig] Details of Boost.Python Py_Finalize issue?

Haoyu Bai divinekid at gmail.com
Fri Aug 7 04:16:59 CEST 2009


On Wed, Aug 5, 2009 at 10:33 AM, Ravi<lists_ravi at lavabit.com> wrote:
> On Sunday 02 August 2009 11:44:22 Haoyu Bai wrote:
>> So could anyone share your experience with this issue, provide some
>> test case or anymore information about this issue? I will try to solve
>> it.
>
> I haven't been able to spend any time on this. But the general approach I
> wanted to check is as follows:
>
> Test 1 (to check registry operation):
> 1. Use an example which embeds (not extends) python.
> 2. Register a type X to be converted to C++ type XC.
> 3. Perform some operations to verify that step 2 works.
> 4. Call PyFinalize.
> 5. Restart python vising PyInit...
> 6. Check that X does not convert to XC.
>
> Test 2 (to check object cleanup):
> 1. Hold weak pointers to some shared_ptr<T> objects exposed to python.
> 2. Call PyFinalize.
> 3. Ensure that all the weak_ptrs point to deleted objects.
>
> Let me think about this some more. Please try pinging Dave A directly to make
> sure he has no tests for you to try.
>
> Regards,
> Ravi
>

Hi,

I have the attached file to check the two test cases you mentioned, or
see it at here: http://pastebin.org/7108

The test #1 failed. Registered converters are not cleaned up during
Py_Finalize. But test #2 not fail, shared_ptr object is properly
destroyed.

I think the registration issue is not hard to fix. But is the "crash"
mentioned in BPL manual still valid? We still can't produce any crash.
I'll check with Dave.

Thanks!

--
Haoyu Bai
School of Computing,
National University of Singapore.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_finalize.cpp
Type: text/x-c++src
Size: 1851 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20090807/18bb3116/attachment.cpp>


More information about the Cplusplus-sig mailing list