From 2bfa8005d4f73d0a77c8ac2e4d5193481747d88d Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Wed, 8 Jun 2011 03:40:14 +0000 Subject: [PATCH] fix python build by exposing the correct constructors for torrent_info, along with default values. Also, avoid making a redundant copy of the torrent_info in dict_to_add_torrent_params --- bindings/python/src/session.cpp | 3 ++- bindings/python/src/torrent_info.cpp | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/bindings/python/src/session.cpp b/bindings/python/src/session.cpp index 0474275c7..b15560b73 100644 --- a/bindings/python/src/session.cpp +++ b/bindings/python/src/session.cpp @@ -144,8 +144,9 @@ namespace void dict_to_add_torrent_params(dict params, add_torrent_params& p, std::vector& rd) { + // torrent_info objects are always held by an intrusive_ptr in the python binding if (params.has_key("ti")) - p.ti = new torrent_info(extract(params["ti"])); + p.ti = extract(params["ti"]); std::string url; if (params.has_key("tracker_url")) diff --git a/bindings/python/src/torrent_info.cpp b/bindings/python/src/torrent_info.cpp index 107e9e26c..23056eedf 100644 --- a/bindings/python/src/torrent_info.cpp +++ b/bindings/python/src/torrent_info.cpp @@ -135,13 +135,14 @@ void bind_torrent_info() class_ >("torrent_info", no_init) #ifndef TORRENT_NO_DEPRECATE - .def(init()) + .def(init((arg("e"), arg("flags") = 0))) #endif - .def(init()) - .def(init()) - .def(init()) + .def(init((arg("info_hash"), arg("flags") = 0))) + .def(init((arg("file"), arg("flags") = 0))) + .def(init((arg("file"), arg("flags") = 0))) + .def(init((arg("ti"), arg("flags") = 0))) #if TORRENT_USE_WSTRING - .def(init()) + .def(init((arg("file"), arg("flags") = 0))) #endif .def("add_tracker", &torrent_info::add_tracker, arg("url"))