Skip to content

Commit

Permalink
Fix deprecated session.add_torrent form to prevent crash
Browse files Browse the repository at this point in the history
  • Loading branch information
AllSeeingEyeTolledEweSew authored and arvidn committed Aug 8, 2021
1 parent 8b386b6 commit 0ec312e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions bindings/python/install_data/libtorrent/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1298,8 +1298,8 @@ class session:
@overload
def add_torrent(
self,
_ti: torrent_info,
_save: _PathLike,
ti: torrent_info,
save: _PathLike,
resume_data: Optional[_Entry] = ...,
storage_mode: storage_mode_t = ...,
paused: bool = ...,
Expand Down
2 changes: 2 additions & 0 deletions bindings/python/src/session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1176,6 +1176,8 @@ void bind_session()
.def(
"add_torrent", depr(&add_torrent_depr)
, (
arg("ti"),
arg("save"),
arg("resume_data") = entry(),
arg("storage_mode") = storage_mode_sparse,
arg("paused") = false
Expand Down
1 change: 0 additions & 1 deletion bindings/python/tests/session_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,6 @@ def setUp(self) -> None:
def tearDown(self) -> None:
lib.cleanup_with_windows_fix(self.dir, timeout=5)

@unittest.skip("https://github.com/arvidn/libtorrent/issues/5989")
def test_old_style_with_wrong_args(self) -> None:
with self.assertRaises(TypeError):
self.session.add_torrent( # type: ignore
Expand Down

0 comments on commit 0ec312e

Please sign in to comment.