{"action":"created","issue":{"url":"https://api.github.com/repos/huge-success/sanic/issues/1422","repository_url":"https://api.github.com/repos/huge-success/sanic","labels_url":"https://api.github.com/repos/huge-success/sanic/issues/1422/labels{/name}","comments_url":"https://api.github.com/repos/huge-success/sanic/issues/1422/comments","events_url":"https://api.github.com/repos/huge-success/sanic/issues/1422/events","html_url":"https://github.com/huge-success/sanic/pull/1422","id":386626568,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM1MzAzNjA2","number":1422,"title":"Add in some server.py __slots__ attribute names that are missing.","user":{"login":"ashleysommer","id":402468,"node_id":"MDQ6VXNlcjQwMjQ2OA==","avatar_url":"https://avatars3.githubusercontent.com/u/402468?v=4","gravatar_id":"","url":"https://api.github.com/users/ashleysommer","html_url":"https://github.com/ashleysommer","followers_url":"https://api.github.com/users/ashleysommer/followers","following_url":"https://api.github.com/users/ashleysommer/following{/other_user}","gists_url":"https://api.github.com/users/ashleysommer/gists{/gist_id}","starred_url":"https://api.github.com/users/ashleysommer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashleysommer/subscriptions","organizations_url":"https://api.github.com/users/ashleysommer/orgs","repos_url":"https://api.github.com/users/ashleysommer/repos","events_url":"https://api.github.com/users/ashleysommer/events{/privacy}","received_events_url":"https://api.github.com/users/ashleysommer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2018-12-03T01:29:50Z","updated_at":"2018-12-03T22:30:15Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/huge-success/sanic/pulls/1422","html_url":"https://github.com/huge-success/sanic/pull/1422","diff_url":"https://github.com/huge-success/sanic/pull/1422.diff","patch_url":"https://github.com/huge-success/sanic/pull/1422.patch"},"body":"While doing some digging in the server.py file this morning, I found that there are a bunch of attributes used in the HTTPProtocol class which are not declared in the `__slots__` tuple at the top of the class.\r\n\r\nNormally not having the attribute name in `__slots__` means the class cannot write to that attribute at runtime (because it doesn't exist) but in this case it never mattered because HTTPProtocol is a subclass of asyncio.Protocol, which itself is a Normal class (no `__slots__`). So having `__slots__` on the HTTPProtocol subclass to restrict its possible attributes is kind-of useless in this case because it doesn't restrict anything.\r\n\r\nBut anyway, for correctness sake this PR adds the missing attribute names to the `__slots__` of Sanic server.py HTTPProtocol."},"comment":{"url":"https://api.github.com/repos/huge-success/sanic/issues/comments/443895449","html_url":"https://github.com/huge-success/sanic/pull/1422#issuecomment-443895449","issue_url":"https://api.github.com/repos/huge-success/sanic/issues/1422","id":443895449,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0Mzg5NTQ0OQ==","user":{"login":"ashleysommer","id":402468,"node_id":"MDQ6VXNlcjQwMjQ2OA==","avatar_url":"https://avatars3.githubusercontent.com/u/402468?v=4","gravatar_id":"","url":"https://api.github.com/users/ashleysommer","html_url":"https://github.com/ashleysommer","followers_url":"https://api.github.com/users/ashleysommer/followers","following_url":"https://api.github.com/users/ashleysommer/following{/other_user}","gists_url":"https://api.github.com/users/ashleysommer/gists{/gist_id}","starred_url":"https://api.github.com/users/ashleysommer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashleysommer/subscriptions","organizations_url":"https://api.github.com/users/ashleysommer/orgs","repos_url":"https://api.github.com/users/ashleysommer/repos","events_url":"https://api.github.com/users/ashleysommer/events{/privacy}","received_events_url":"https://api.github.com/users/ashleysommer/received_events","type":"User","site_admin":false},"created_at":"2018-12-03T22:30:15Z","updated_at":"2018-12-03T22:30:15Z","author_association":"MEMBER","body":"@vltr another interesting observation.\r\nAdding:\r\n```\r\n__dict__ = None\r\n```\r\nTo the top of the `HTTPProtocol` class shows `self.__dict__` is `None` at runtime.\r\n```\r\nself.__dict__\r\n<NoneType>\r\n```\r\n\r\nBut the code can still write non-slot attributes to the class.\r\n```\r\nself.cat = \"Hello\"\r\n```\r\nTurns out in this case it adds the attribute to the _Parent Class's_ `__dict__`:\r\n```\r\nself.__dict__\r\n<NoneType>\r\n\r\nsuper(HttpProtocol, self).__dict__\r\n<class 'dict'>: {'cat': \"Hello\"}\r\n```\r\nNot sure the implications of that. But anyway, that observation doesn't affect Sanic."}}
{"actor":{"display_login":"ashleysommer"}}