diff --git a/CodeGenerator/templates/GithubObject.py b/CodeGenerator/templates/GithubObject.py index e0ac5bf3..2b10f68e 100644 --- a/CodeGenerator/templates/GithubObject.py +++ b/CodeGenerator/templates/GithubObject.py @@ -91,7 +91,7 @@ class {{ class.name }}( object ): {% endif %} {% if attribute.type.cardinality == "list" %} - assert isinstance( attributes[ "{{ attribute.name }}" ], list ) + assert isinstance( attributes[ "{{ attribute.name }}" ], list ) and ( len( attributes[ "{{ attribute.name }}" ] ) == 0 or isinstance( attributes[ "{{ attribute.name }}" ][ 0 ], dict ) ) self.__{{ attribute.name }} = [ {% if attribute.type.name != class.name %}{{ attribute.type.name }}.{% endif %}{{ attribute.type.name }}( self.__requester, element, lazy = True ) for element in attributes[ "{{ attribute.name }}" ] diff --git a/github/GithubObjects/GitCommit.py b/github/GithubObjects/GitCommit.py index a781d0a8..260ef2d7 100644 --- a/github/GithubObjects/GitCommit.py +++ b/github/GithubObjects/GitCommit.py @@ -90,7 +90,7 @@ class GitCommit( object ): assert isinstance( attributes[ "message" ], ( str, unicode ) ) self.__message = attributes[ "message" ] if "parents" in attributes and attributes[ "parents" ] is not None: - assert isinstance( attributes[ "parents" ], list ) + assert isinstance( attributes[ "parents" ], list ) and ( len( attributes[ "parents" ] ) == 0 or isinstance( attributes[ "parents" ][ 0 ], dict ) ) self.__parents = [ GitCommit( self.__requester, element, lazy = True ) for element in attributes[ "parents" ]