Skip to content

Avoid service requests for nonpositive pager limits - #338

Open
vinsymoyya wants to merge 1 commit into
google:masterfrom
vinsymoyya:fix/pager-negative-limit
Open

vinsymoyya wants to merge 1 commit into
google:masterfrom
vinsymoyya:fix/pager-negative-limit

Conversation

@vinsymoyya

Copy link
Copy Markdown

Treat negative pager limits like zero limits: yield no records and make no service requests. Previously a negative limit stayed truthy as it decreased, so the pager fetched and yielded all available records, potentially sending a negative page size to the service.

Fixes #100.

The new dedicated regression module checks two negative limits, zero, a positive bound, unlimited iteration, and preservation of the caller's request. Both negative cases fail against current master (468a297c3306f7bb136be918847930580dc3aa7e), while all three controls pass.

Validation on Python 3.12:

  • 62 tests pass across the pager, new limit regressions, and encoding suites.
  • pycodestyle 2.4.0 (the repository's pinned lint version) and git diff --check pass for changed files.
  • No live API integration, historical Python 2 runtime, or legacy Travis matrix was run locally. The source and tests retain the surrounding code's syntax compatibility.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

list_pager.YieldFromList with negative limit returns all data

1 participant