Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

integrate support of std::shared_ptr in addition to boost::shared_ptr and perhaps other smart pointers implementing similar concepts #29

Closed
nevion opened this issue Jul 27, 2015 · 25 comments
Labels

Comments

@nevion
Copy link
Contributor

nevion commented Jul 27, 2015

currently the support of boost::shared_ptr islands code using std::shared_ptr. While in some cases the user can simply choose to use boost::shared_ptr over std::shared_ptr, this does not work on a pre-existing library whom chose to use std::shared_ptr.

It may also be worth considering older libraries out there who'm had chosen to implement their own smart ptr ( e.g. OpenSceneGraph, ITK/VTK) though I'm not sure they'll support 1:1 the same exact concepts shared_ptr does.

@owenhaynes
Copy link

Could do with this.

@bhack
Copy link

bhack commented Sep 19, 2015

👍

@eudoxos
Copy link

eudoxos commented Sep 27, 2015

This is the original ticket: https://svn.boost.org/trac/boost/ticket/6545 and the missing functionality with std::shared_ptr (no implciit upcasting) was discussed at c++-sig http://thread.gmane.org/gmane.comp.python.c++/15759/focus=15771 .

@KayEss
Copy link

KayEss commented Dec 19, 2015

Did something change here between 1.59 and 1.60? I'm just testing the new version and we're getting testing errors now with things like:

TypeError: No to_python (by-value) converter found for C++ type: std::shared_ptr<fostlib::jsondb::local>

We have recently changed these from using boost::shared_ptr to std::shared_ptr, but everything works in Boost 1.56 to 1.59 but it fails now with 1.60. The wrapper is here.

I saw the post linked above, but have no idea where to put that. I don't think this is affected anyway as there is no class hierarchy involved.

@stefanseefeld
Copy link
Member

I'm not aware of any related changes in Boost.Python. In particular, I don't think std::shared_ptr was ever supported in Boost.Python (I do want to add support for this, but haven't had the time to set up builds with a C++11 compatible compiler to test this.)

@KayEss
Copy link

KayEss commented Dec 19, 2015

Thanks. Sounds like I ought to convert all of the std::shared_ptr to boost::shared_ptr though anyway. Hopefully that will work.

EDIT: Ok, that didn't work either. I don't really have time to dive down deeply into this today. Will try again in a few days

@ycollet
Copy link

ycollet commented Jan 7, 2016

The same for me here.
Our application works fine with boost-1.59 and fails with boost-1.60 with problems related to shared_ptr.

@KayEss
Copy link

KayEss commented Jan 8, 2016

@ycollet What are the actual errors that you see? Are you seeing the same sort of errors we are? We're getting problems in the type registry:

TypeError: No to_python (by-value) converter found for C++ type: boost::shared_ptr<fostlib::jsondb::local>

I've switched between std::shared_ptr and boost::shared_ptr and it doesn't make any difference. I wonder what changes were made to shared_ptr between 1.59 and 1.60....

@ycollet
Copy link

ycollet commented Jan 8, 2016

I've got the same error message as you:

TypeError: No to_python (by-value) converter found for C++ type: boost::shared_ptr<*>

----- Mail original -----
De: "Kirit Sælensminde" notifications@github.com
À: "boostorg/python" python@noreply.github.com
Cc: "ycollet" ycollette.nospam@free.fr
Envoyé: Vendredi 8 Janvier 2016 06:10:53
Objet: Re: [python] integrate support of std::shared_ptr in addition to boost::shared_ptr and perhaps other smart pointers implementing similar concepts (#29)

@ycollet What are the actual errors that you see? Are you seeing the same sort of errors we are? We're getting problems in the type registry: TypeError: No to_python (by-value) converter found for C++ type: boost::shared_ptrfostlib::jsondb::local

I've switched between std::shared_ptr and boost::shared_ptr and it doesn't make any difference. I wonder what changes were made to shared_ptr between 1.59 and 1.60....


Reply to this email directly or view it on GitHub .

@KayEss
Copy link

KayEss commented Jan 8, 2016

There's nothing in the release notes about changes to either the python or pointer libraries. I think it's fair to say that if we're both getting the same sort of problem it's less likely that we're both doing the same stupid thing that triggers it.

I've been meaning to set up a build mechanism that would allow me to build against the current development version of Boost. If I can do that then bisecting between 1.59 and 1.60 might find the problem.

BTW, I'm doing C++14 builds and get the same problem on both gcc and clang.

@ycollet
Copy link

ycollet commented Jan 8, 2016

I fear that this problem comes from a change from a change on another lib.
I had a look at the changes between 1.59 and 1.60 and nothing really evident shows up.

@stefanseefeld
Copy link
Member

Thanks for investigating this !
Just FYI, I'm experimenting with ways to build Boost.Python stand-alone (using something other than Boost.Build), to make it easier to maintain and perhaps even develop. Right now I'm still stuck with Boost.Build, and I have a hard time doing anything with it, including trying to change compiler flags (such as adding --std=c++11) so I can experiment with adding support for std::shared_ptr.

@KayEss
Copy link

KayEss commented Jan 11, 2016

@stefanseefeld This may help you: https://github.com/KayEss/fost-py/blob/master/Cpp/fost-json-py/Jamfile

The $TARGET_REQUIREMENTS are defined in https://github.com/KayEss/fost-base/blob/master/fost.jam#L37 You'll notice it includes C++14 flags.

It is also possible to pass in compiler flags to the bjam command line, but I forget how to do that :) It is nearly impossible to find this stuff in the docs :(

@finjulhich
Copy link

you can ask on the boost or boost-build mailing list, from experience,
Vladimir answers promptly.

On 11 January 2016 at 04:22, Kirit Sælensminde notifications@github.com
wrote:

@stefanseefeld https://github.com/stefanseefeld This may help you:
https://github.com/KayEss/fost-py/blob/master/Cpp/fost-json-py/Jamfile

The $TARGET_REQUIREMENTS are defined in
https://github.com/KayEss/fost-base/blob/master/fost.jam#L37 You'll
notice it includes C++14 flags.

It is also possible to pass in compiler flags to the bjam command line,
but I forget how to do that :) It is nearly impossible to find this stuff
in the docs :(


Reply to this email directly or view it on GitHub
#29 (comment).

@jhunold
Copy link
Contributor

jhunold commented Jan 11, 2016

See http://www.boost.org/build/doc/html/bbv2/overview/builtins/features.html for the "cxxflags" feature.
Or just grep the Jamfiles in the Boost sources for "-std=" to find existing examples.

@bennybp
Copy link

bennybp commented Feb 4, 2016

I'm also experiencing the error with boost::shared_ptr referenced by @KayEss and @ycollet. I managed to bisect with a simple test program and script. It appears to come from an update/rewrite of type_traits around commit f0da159e1f52e87ad71e4747de6b042c54578e0e (in the type_traits submodule, although that commit won't compile for me).

Unfortunately, it looks like a big rewrite in one commit, so I don't know the exact cause, but I hope this helps

@KayEss
Copy link

KayEss commented Feb 4, 2016

Well found @bennybp Here's a link to the commit. Not really surprised there was a regression in it given how large it is.

@epot
Copy link

epot commented Feb 5, 2016

Concerning the boost regression between 1.59 and 1.60, I had a similar one ad I created a post on stackoverflow about it:
http://stackoverflow.com/questions/35056398/typeerror-when-iterating-over-a-boostpython-vector

If we do have the same issue, it is completely unrelated to smart pointers.

@eudoxos
Copy link

eudoxos commented Feb 10, 2016

Just as a reminder, the problem with missing converter which arose between 1.59 and 1.60 is, as far as I see, orthogonal to this issue (though certainly valid) -- which is to support std::shared_ptr (and perhaps other smart pointer types) at the same level as boost::shared_ptr (including e.g. automatic upcasting).

@epot
Copy link

epot commented Feb 10, 2016

I definitely agree: I have this issue without any smart pointer.

On Wed, 10 Feb 2016 at 09:58 eudoxos notifications@github.com wrote:

Just as a reminder, the problem with missing converter which arose between
1.59 and 1.60 is, as far as I see, orthogonal to this issue (though
certainly valid) -- which is to support std::shared_ptr (and perhaps other
smart pointer types) at the same level as boost::shared_ptr (including e.g.
automatic upcasting).


Reply to this email directly or view it on GitHub
#29 (comment).

@wojdyr
Copy link

wojdyr commented Feb 11, 2016

@eudoxos @epot yes, so I just opened a separate issue for the regression, linked above

@stefanseefeld
Copy link
Member

I have just merged support for std::shared_ptr into the develop branch (97e4b34), so whenever Boost.Python is compiled with a C++11-compliant compiler std::shared_ptr is supported in exactly the same way as boost::shared_ptr. I plan to add some documentation (in particular release notes), then prepare for this to be merged into master for the next (i.e., 1.63) release.

@NOhs
Copy link

NOhs commented Nov 9, 2016

I can't find this feature in the notes for the 1.63 release svn-milestone-1.63-link. Is it just not in that list, or will it be delayed?

@stefanseefeld
Copy link
Member

It will be part of 1.63. See http://www.boost.org/users/history/version_1_63_0.html for tentative release notes. (I doubt trac will reflect current efforts, as more and more projects move over to github issue tracking.)

@NOhs
Copy link

NOhs commented Nov 9, 2016

Nice. Looking forward to it!

arahlin added a commit to CMB-S4/spt3g_software that referenced this issue Nov 20, 2024
Boost version 1.63 and newer [supports](boostorg/python#29) `std::shared_ptr` python converters.  Thus, in this PR, all boost shared pointers are replaced with standard library shared pointers everywhere in the library.  The required C++ standard is also increased to C++17, since shared pointers for allocated C arrays do not work with the older standards.

In the process, this PR also updates the cereal library to the latest version (1.3.2) without any patching.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests