Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4443eeb

Browse files
authored
Merge pull requestsigmavirus24#962 from smendes/fix-getattr
Fix potential infinite recursion in __getattr__
2 parents9e749aa +5509030 commit4443eeb

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

‎AUTHORS.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,4 +183,6 @@ Contributors
183183

184184
- Tigran Tchougourian (@NargiT)
185185

186-
- Dimitri Merejkowsky (@dmerejkowsky)
186+
- Samuel Mendes (@smendes)
187+
188+
- Dimitri Merejkowsky (@dmerejkowsky)

‎src/github3/models.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,10 @@ def _update_attributes(self, json):
5454

5555
def__getattr__(self,attribute):
5656
"""Proxy access to stored JSON."""
57-
ifattributenotinself._json_data:
57+
_json_data=object.__getattribute__(self,"_json_data")
58+
ifattributenotin_json_data:
5859
raiseAttributeError(attribute)
59-
value=self._json_data.get(attribute)
60+
value=_json_data[attribute]
6061
setattr(self,attribute,value)
6162
returnvalue
6263

‎tests/unit/test_models.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
importpytest
44
importrequests
55

6+
fromcopyimportcopy
67
fromdatetimeimportdatetime,timedelta
78
fromgithub3importexceptions,GitHubError
89
fromgithub3.modelsimportGitHubCore
@@ -206,6 +207,10 @@ def test_strptime_time_str_required(self):
206207
"""Verify that method converts ISO 8601 formatted string."""
207208
assertself.instance._strptime("")isNone
208209

210+
deftest_can_be_copied(self):
211+
"""Verify that a GithubCore object can be copied."""
212+
assertcopy(self.instance)isnotNone
213+
209214

210215
classTestGitHubCoreIssue672(helper.UnitHelper):
211216

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp