fix: read has_metadata from torrent status - #288
Merged
stabldev merged 3 commits intoAug 15, 2026
Conversation
torrent_handle.has_metadata() is deprecated upstream and is compiled out of builds configured without deprecated functions, which is how Arch ships libtorrent-rasterbar 2.1. On those builds check_metadata_updates() raises AttributeError: 'torrent_handle' object has no attribute 'has_metadata'. torrent_status.has_metadata carries the same information and is present on every version the project supports (libtorrent>=2.0.11), so read it from handle.status() instead. Fixes stabldev#285
stabldev
requested changes
Aug 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #285
Problem
check_metadata_updates()callshandle.has_metadata(). That method is deprecated upstream and is compiled out of libtorrent builds configured without deprecated functions — which is how Arch shipslibtorrent-rasterbar 2.1. On those builds the call raises:pyproject.tomldeclareslibtorrent>=2.0.11, so 2.1 is inside the supported range.Fix
Read the same information from
handle.status().has_metadata, which is present on every supported version.Verification
Confirmed against libtorrent 2.1.1 on a real
torrent_handlebuilt from a magnet URI:Same value, and the deprecation warning goes away. On the PyPI build the old call still exists but is deprecated; on Arch's build it is absent entirely, which is the crash in the report.
Test suite: 36 passed, 3 errors before and after this change — the 3 are
tests/snapshotsneeding thesnap_comparefixture (pytest-textual-snapshotnot installed locally) and are unrelated.