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

Commitbd86c87

Browse files
cesarizuByron
authored andcommitted
FixAttributeError when searching a remote by name
Running code like `'origin' in git.Repo('path/to/existing/repository').remotes`raises an AttributeError instead of returning a boolean. This commit fixes thatbehaviour by catching the error when doing an identity match on `IterableList`.
1 parente93ffe1 commitbd86c87

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

‎AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,6 @@ Contributors are:
3232
-A. Jesse Jiryu Davis <jesse _at_ emptysquare.net>
3333
-Steven Whitman <ninloot _at_ gmail.com>
3434
-Stefan Stancu <stefan.stancu _at_ gmail.com>
35+
-César Izurieta <cesar _at_ caih.org>
3536

3637
Portions derived from other open source works and are clearly marked.

‎git/util.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -864,9 +864,12 @@ def __init__(self, id_attr, prefix=''):
864864

865865
def__contains__(self,attr):
866866
# first try identity match for performance
867-
rval=list.__contains__(self,attr)
868-
ifrval:
869-
returnrval
867+
try:
868+
rval=list.__contains__(self,attr)
869+
ifrval:
870+
returnrval
871+
except (AttributeError,TypeError):
872+
pass
870873
# END handle match
871874

872875
# otherwise make a full name search

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp