Skip to content

Commit

Permalink
Use setattr instead of assignment for redefining a method
Browse files Browse the repository at this point in the history
This is caused because of mypy's issue sanic-org#2427
python/mypy#2427
  • Loading branch information
viniciusd committed Sep 20, 2019
1 parent 9d009f2 commit 6087df1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sanic/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ async def create(
instance = cls()
instance.sanic_app = sanic_app
instance.transport = MockTransport(scope, receive, send)
instance.transport.add_task = sanic_app.loop.create_task
instance.transport.loop = sanic_app.loop
setattr(instance.transport, "add_task", sanic_app.loop.create_task)

headers = Header(
[
Expand Down

0 comments on commit 6087df1

Please sign in to comment.