Skip to content

Fix silence_exceptions tuple and comparison against missing update date - #101

Merged
idlesign merged 1 commit into
idlesign:masterfrom
GriffTanen:fix/latent-bugs
Aug 31, 2026
Merged

idlesign merged 1 commit into
idlesign:masterfrom
GriffTanen:fix/latent-bugs

Conversation

@GriffTanen

Copy link
Copy Markdown
Contributor

Two small, unrelated bugs found while looking at something else.

1. silence_exceptions is always truthy

src/torrt/utils.py:

self.silence_exceptions = silence_exceptions,   # note the trailing comma

The trailing comma makes this a tuple, so HttpClient(silence_exceptions=False)
stores (False,), which is truthy. As a result raise_on_error_response = True
— set by tests/trackers/* precisely to make request errors visible — has no
effect, and failures stay swallowed.

>>> HttpClient(silence_exceptions=False).silence_exceptions
(False,)

Removing the comma restores the intended behaviour. I ran the tracker tests
afterwards to check that unmasking errors does not surface new failures — it
does not; they still pass.

2. TypeError when a tracker reports no update date

src/torrt/base_tracker.py:

if last_updated and last_updated >= page_data.date_updated:

extract_page_date_updated() returns None by default, and both the kinozal and
nnmclub implementations also return None when the date cannot be parsed. Once a
torrent has a stored date_updated, the next walk raises:

TypeError: '>=' not supported between instances of 'datetime.datetime' and 'NoneType'

Guarding the comparison keeps the previous behaviour for the no-date case: we do
not skip, we go and fetch.

🤖 Generated with Claude Code

…date

Two unrelated latent bugs:

* a stray trailing comma made `HttpClient.silence_exceptions` a tuple, always
  truthy, so `raise_on_error_response = True` never actually surfaced errors;
* `get_torrent()` compared `last_updated` against `page_data.date_updated`
  without checking the latter for `None`, raising `TypeError` for trackers that
  do not extract a date or fail to parse one.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 33317791939

Coverage increased (+0.02%) to 67.991%

Details

  • Coverage increased (+0.02%) from the base build.
  • Patch coverage: 3 of 3 lines across 2 files are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 1687
Covered Lines: 1147
Line Coverage: 67.99%
Coverage Strength: 3.87 hits per line

💛 - Coveralls

@idlesign
idlesign self-requested a review August 31, 2026 07:17
@idlesign idlesign added the bug label Aug 31, 2026
@idlesign
idlesign merged commit 07c3174 into idlesign:master Aug 31, 2026
7 checks passed
@idlesign

Copy link
Copy Markdown
Owner

Thank you. Merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants