diff --git a/bindings/python/src/create_torrent.cpp b/bindings/python/src/create_torrent.cpp index 53e95432a..972269d6d 100644 --- a/bindings/python/src/create_torrent.cpp +++ b/bindings/python/src/create_torrent.cpp @@ -22,11 +22,26 @@ namespace obj(i); } +#ifndef BOOST_NO_EXCEPTIONS void set_piece_hashes_callback(create_torrent& c, std::string const& p , boost::python::object cb) { set_piece_hashes(c, p, boost::bind(call_python_object, cb, _1)); } +#else + void set_piece_hashes_callback(create_torrent& c, std::string const& p + , boost::python::object cb) + { + error_code ec; + set_piece_hashes(c, p, boost::bind(call_python_object, cb, _1), ec); + } + + void set_piece_hashes0(create_torrent& c, std::string const & s) + { + error_code ec; + set_piece_hashes(c, s, ec); + } +#endif void add_node(create_torrent& ct, std::string const& addr, int port) { @@ -47,7 +62,9 @@ void bind_create_torrent() void (file_storage::*set_name1)(std::wstring const&) = &file_storage::set_name; #endif +#ifndef BOOST_NO_EXCEPTIONS void (*set_piece_hashes0)(create_torrent&, std::string const&) = &set_piece_hashes; +#endif void (*add_files0)(file_storage&, std::string const&, boost::uint32_t) = add_files; class_("file_storage") diff --git a/bindings/python/src/magnet_uri.cpp b/bindings/python/src/magnet_uri.cpp index 9520df88e..b68fc6ec3 100644 --- a/bindings/python/src/magnet_uri.cpp +++ b/bindings/python/src/magnet_uri.cpp @@ -44,7 +44,12 @@ namespace { p.auto_managed = params["auto_managed"]; p.duplicate_is_error = params["duplicate_is_error"]; +#ifndef BOOST_NO_EXCEPTIONS return add_magnet_uri(s, uri, p); +#else + error_code ec; + return add_magnet_uri(s, uri, p, ec); +#endif } } diff --git a/bindings/python/src/session.cpp b/bindings/python/src/session.cpp index 93d0e41de..1355d4757 100644 --- a/bindings/python/src/session.cpp +++ b/bindings/python/src/session.cpp @@ -58,6 +58,7 @@ namespace s.add_extension(invoke_extension_factory(e)); } +#ifndef BOOST_NO_EXCEPTIONS #ifndef TORRENT_NO_DEPRECATE torrent_handle add_torrent_depr(session& s, torrent_info const& ti , std::string const& save, entry const& resume @@ -66,6 +67,7 @@ namespace allow_threading_guard guard; return s.add_torrent(ti, save, resume, storage_mode, paused, default_storage_constructor); } +#endif #endif torrent_handle add_torrent(session& s, dict params) @@ -112,21 +114,24 @@ namespace if (params.has_key("override_resume_data")) p.override_resume_data = params["override_resume_data"]; +#ifndef BOOST_NO_EXCEPTIONS return s.add_torrent(p); +#else + error_code ec; + return s.add_torrent(p, ec); +#endif } void start_natpmp(session& s) { allow_threading_guard guard; s.start_natpmp(); - return; } void start_upnp(session& s) { allow_threading_guard guard; s.start_upnp(); - return; } alert const* wait_for_alert(session& s, int ms) @@ -147,16 +152,16 @@ namespace } #ifndef TORRENT_DISABLE_GEO_IP - bool load_asnum_db(session& s, std::string file) + void load_asnum_db(session& s, std::string file) { allow_threading_guard guard; - return s.load_asnum_db(file.c_str()); + s.load_asnum_db(file.c_str()); } - bool load_country_db(session& s, std::string file) + void load_country_db(session& s, std::string file) { allow_threading_guard guard; - return s.load_country_db(file.c_str()); + s.load_country_db(file.c_str()); } #endif @@ -303,6 +308,7 @@ void bind_session() .def("dht_proxy", allow_threads(&session::dht_proxy), return_value_policy()) #endif .def("add_torrent", &add_torrent) +#ifndef BOOST_NO_EXCEPTIONS #ifndef TORRENT_NO_DEPRECATE .def( "add_torrent", &add_torrent_depr @@ -312,6 +318,7 @@ void bind_session() arg("paused") = false ) ) +#endif #endif .def("remove_torrent", allow_threads(&session::remove_torrent), arg("option") = session::none ) diff --git a/bindings/python/src/torrent_info.cpp b/bindings/python/src/torrent_info.cpp index dfafc9db4..be43aed85 100644 --- a/bindings/python/src/torrent_info.cpp +++ b/bindings/python/src/torrent_info.cpp @@ -83,6 +83,14 @@ namespace return result; } + bool get_tier(announce_entry const& ae) + { return ae.tier; } + bool get_fail_limit(announce_entry const& ae) + { return ae.fail_limit; } + bool get_fails(announce_entry const& ae) + { return ae.fails; } + bool get_source(announce_entry const& ae) + { return ae.source; } bool get_verified(announce_entry const& ae) { return ae.verified; } bool get_updating(announce_entry const& ae) @@ -173,10 +181,10 @@ void bind_torrent_info() class_("announce_entry", init()) .def_readwrite("url", &announce_entry::url) - .def_readwrite("tier", &announce_entry::tier) - .add_property("fail_limit", &announce_entry::fail_limit) - .add_property("fails", &announce_entry::fails) - .add_property("source", &announce_entry::source) + .def_readwrite("tier", &get_tier) + .add_property("fail_limit", &get_fail_limit) + .add_property("fails", &get_fails) + .add_property("source", &get_source) .add_property("verified", &get_verified) .add_property("updating", &get_updating) .add_property("start_sent", &get_start_sent)