[#1217] Fix RuntimeWarning registering pointer with Python

This fix checks for existing registered pointers for alert so that Boost
does not output the following warning when importing libtorrent in Python:

> RuntimeWarning: to-Python converter for boost::shared_ptrlibtorrent::alert already registered; second conversion method ignored.
This commit is contained in:
Calum Lind 2017-01-14 18:58:57 +00:00 committed by Arvid Norberg
parent febcbbf17c
commit de499310f5
1 changed files with 6 additions and 4 deletions

View File

@ -170,9 +170,11 @@ void bind_alert()
using boost::noncopyable;
#ifndef TORRENT_NO_DEPRECATE
typedef boost::shared_ptr<alert> alert_holder;
#if BOOST_VERSION >= 106000
if (boost::python::converter::registry::query(
boost::python::type_id <boost::shared_ptr<alert> >()) == NULL) {
register_ptr_to_python<boost::shared_ptr<alert> >();
#endif
}
#else
typedef alert alert_holder;
#endif