nebius/SWE-bench-extra huggingface dataset:
Repository: sgaynetdinov/py-vkontakte

Issue:
Raise error StopIteration
```
list(group.get_members())
```

python3.7

Comments:

Patch:
diff --git a/vk/fetch.py b/vk/fetch.py
index b0eb38e..761408c 100644
--- a/vk/fetch.py
+++ b/vk/fetch.py
@@ -65,7 +65,7 @@ class Session:
                 items = res['items']
 
             if not items:
-                raise StopIteration
+                return None
 
             for i in items:
                 yield constructor_from_json(self, i)


Test patch:
diff --git a/tests/test_fetch.py b/tests/test_fetch.py
index 711b724..ae22ee4 100644
--- a/tests/test_fetch.py
+++ b/tests/test_fetch.py
@@ -1,7 +1,10 @@
 import io
 
+import pytest
+
 import vk
 from vk.fetch import Session
+from vk.users import User
 
 
 def test_url_open(mocker):
@@ -29,3 +32,12 @@ def test_upload_photo():
     assert b'Content-Type: application/octet-stream' in data
     assert b'Python developer and blogger.' in data
     assert boundary.encode() in data
+
+def test_fetch_items_stop_iteration(mocker):
+    fetch = mocker.patch('vk.fetch.Session.fetch')
+    fetch.return_value = {'items': []}
+
+    got = Session().fetch_items('test', User.from_json, 10)
+
+    with pytest.raises(StopIteration):
+        next(got)