nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: sigmavirus24/github3.py
Pull request #962 (2019-07-23 12:36:52)

Fix potential infinite recursion in __getattr__
I ran into an issue causing the infinite recursion, I saw that PR https://github.com/sigmavirus24/github3.py/pull/912 was already open for it and the discussion that goes with it. But that PR hasn't changed in a while and didn't include a test for this bug.

I think this bug only happens for Python 3+ (I can at least confirm it with 3.7), when calling `copy` on a `GithubCore` instance a call to `foo.__getattr__("_json_data")` is made while `__init__` wasn't called. Causing `self._json_data` [here](https://github.com/sigmavirus24/github3.py/blob/master/src/github3/models.py#L57) to call again `self.__getattr__("_json_data")` and so on.

By using `object.__getattribute__(self, "_json_data")` instead we make sure that we won't fallback on `__getattr__` and avoid this infinite loop.


Patch:
diff --git a/AUTHORS.rst b/AUTHORS.rst
index f15bbee9..d7f0dbe8 100644
--- a/AUTHORS.rst
+++ b/AUTHORS.rst
@@ -183,4 +183,6 @@ Contributors
 
 - Tigran Tchougourian (@NargiT)
 
-- Dimitri Merejkowsky (@dmerejkowsky)
+- Samuel Mendes (@smendes)
+
+- Dimitri Merejkowsky (@dmerejkowsky)
\ No newline at end of file
diff --git a/src/github3/models.py b/src/github3/models.py
index 26f9db58..225ab05e 100644
--- a/src/github3/models.py
+++ b/src/github3/models.py
@@ -54,9 +54,10 @@ class GitHubCore(object):
 
     def __getattr__(self, attribute):
         """Proxy access to stored JSON."""
-        if attribute not in self._json_data:
+        _json_data = object.__getattribute__(self, "_json_data")
+        if attribute not in _json_data:
             raise AttributeError(attribute)
-        value = self._json_data.get(attribute)
+        value = _json_data[attribute]
         setattr(self, attribute, value)
         return value
 


Test patch:
diff --git a/tests/unit/test_models.py b/tests/unit/test_models.py
index 1922458d..7d99d57f 100644
--- a/tests/unit/test_models.py
+++ b/tests/unit/test_models.py
@@ -3,6 +3,7 @@ import json
 import pytest
 import requests
 
+from copy import copy
 from datetime import datetime, timedelta
 from github3 import exceptions, GitHubError
 from github3.models import GitHubCore
@@ -206,6 +207,10 @@ class TestGitHubCore(helper.UnitHelper):
         """Verify that method converts ISO 8601 formatted string."""
         assert self.instance._strptime("") is None
 
+    def test_can_be_copied(self):
+        """Verify that a GithubCore object can be copied."""
+        assert copy(self.instance) is not None
+
 
 class TestGitHubCoreIssue672(helper.UnitHelper):
Repository: sigmavirus24/github3.py
Pull request #1042 (2021-09-27 12:29:44)

Add rebaseable field to _PullRequest
According to the: https://docs.github.com/en/rest/reference/pulls#get-a-pull-request 
we could have `rebaseable` field in response.

<!-- links -->
[search]: https://github.com/sigmavirus24/github3.py/issues?utf8=%E2%9C%93&q=is%3Aissue


sigmavirus24: From the tests:

```
tests/unit/test_pulls.py:201:1: E302 expected 2 blank lines, found 1
```

Patch:
diff --git a/src/github3/pulls.py b/src/github3/pulls.py
index 332def3a..eaf4c721 100644
--- a/src/github3/pulls.py
+++ b/src/github3/pulls.py
@@ -218,6 +218,7 @@ class _PullRequest(models.GitHubCore):
         self.merged_at = self._strptime(pull["merged_at"])
         self.number = pull["number"]
         self.patch_url = pull["patch_url"]
+        self.rebaseable = pull.get("rebaseable")
         requested_reviewers = pull.get("requested_reviewers", [])
         self.requested_reviewers = [
             users.ShortUser(r, self) for r in requested_reviewers
@@ -838,6 +839,11 @@ class ShortPullRequest(_PullRequest):
 
         The URL to retrieve the patch for this pull request via the API.
 
+    .. attribute:: rebaseable
+
+        A boolean attribute indicating whether GitHub deems this pull request
+        is rebaseable. None if not set.
+
     .. attribute:: repository
 
         A :class:`~github3.repos.repo.ShortRepository` from the :attr:`base`


Test patch:
diff --git a/tests/unit/test_pulls.py b/tests/unit/test_pulls.py
index 6e65d340..4af8ffc6 100644
--- a/tests/unit/test_pulls.py
+++ b/tests/unit/test_pulls.py
@@ -196,6 +196,7 @@ class TestPullRequest(helper.UnitHelper):
         )
         assert not self.instance.merged
         assert self.instance.mergeable
+        assert not self.instance.rebaseable
 
 
 class TestPullReview(helper.UnitHelper):