Skip to content

ResourceCollection.limit(0) yields one item #4670

@T90REAL

Description

@T90REAL

Describe the bug

Calling limit(0) on a ResourceCollection yields one item instead of none.

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

[]

Current Behavior

['first']

Reproduction Steps

from boto3.resources.collection import ResourceCollection

class DummyCollection(ResourceCollection):
    def __init__(self, limit):
        self._params = {"limit": limit}
    def pages(self):
        yield ["first", "second"]

items = list(DummyCollection(0))
print(items)

Possible Solution

No response

Additional Information/Context

Note: This issue was identified by an automated testing tool for academic research and manually checked. If you have any concerns about this type of reporting, please let me know, and I will adjust my workflow accordingly. Thanks.

SDK version used

1.40.64

Environment details (OS name and version, etc.)

Linux | Python3.12

Metadata

Metadata

Labels

bugThis issue is a confirmed bug.investigatingThis issue is being investigated and/or work is in progress to resolve the issue.p3This is a minor priority issueresources

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions