Opened 13 years ago

Last modified 9 years ago

#3673 assigned Feature Requests

boost python and weak_ptr from a shared_ptr argument

Reported by: troy d. straszheim Owned by: troy d. straszheim
Milestone: Boost 1.43.0 Component: python USE GITHUB
Version: Boost 1.41.0 Severity: Problem
Keywords: Cc:

Description

if you save a weak_ptr of a shared_ptr passed to you by python, it expires almost immediately (see use of aliasing constructor in shared_ptr_from_python.hpp). See also mail from Jahn Fuchs on c++-sig list subject: boost python and weak_ptr from a shared_ptr argument

Attachments (2)

weak_ptr.cpp (595 bytes ) - added by Olaf Lenz <olaf@…> 13 years ago.
Testcase for the problem
testWeakPtr.py (94 bytes ) - added by Olaf Lenz <olaf@…> 13 years ago.
Python file of the test case

Download all attachments as: .zip

Change History (6)

comment:1 by troy d. straszheim, 13 years ago

Owner: changed from Dave Abrahams to troy d. straszheim
Status: newassigned

by Olaf Lenz <olaf@…>, 13 years ago

Attachment: weak_ptr.cpp added

Testcase for the problem

by Olaf Lenz <olaf@…>, 13 years ago

Attachment: testWeakPtr.py added

Python file of the test case

comment:2 by Olaf Lenz <olaf@…>, 13 years ago

Milestone: Boost 1.42.0Boost 1.43.0

I provided a simple test case that demonstrates the problem. Just compile "weak_ptr.cpp", adapt the imports and run the python script, and you will get

> python testWeakPtr.py 
python: /home/olenz/projects/espresso++/src/trunk/contrib/boost/boost/smart_ptr/shared_ptr.hpp:409: T* boost::shared_ptr< <template-parameter-1-1> >::operator->() const [with T = A]: Assertion `px != 0' failed.
Aborted

comment:3 by eu@…, 9 years ago

I confirm this bug with boost 1.49. Perhaps should be goal version updated?

comment:4 by eu@…, 9 years ago

PS for the reference a post at stackoverflow dealing with this problem: http://stackoverflow.com/questions/8233252/boostpython-and-weak-ptr-stuff-disappearing

Note: See TracTickets for help on using tickets.