Skip to content
This repository has been archived by the owner on Feb 25, 2022. It is now read-only.

python37 type check fix #612

Merged
merged 1 commit into from Aug 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -6,6 +6,7 @@ python:
- "pypy3.5"
- "3.5"
- "3.6"
- "3.7-dev"

install:
- pip install -r requirements.txt
Expand Down
5 changes: 3 additions & 2 deletions apistar/server/core.py
Expand Up @@ -88,9 +88,10 @@ def generate_response(self, handler):
return Response(encoding='application/json', status_code=200, schema=annotation)

def coerce_generics(self, annotation):
origin = getattr(annotation, '__origin__', annotation)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't say it make me happy, but sure.

if (
isinstance(annotation, type) and
issubclass(annotation, typing.List) and
isinstance(origin, type) and
issubclass(origin, typing.List) and
getattr(annotation, '__args__', None) and
issubclass(annotation.__args__[0], types.Type)
):
Expand Down