Skip to content

Commit 28fba50

Browse files
[PR #9809/c9c08748 backport][3.11] Add __slots__ to UrlMappingMatchInfo (#9813)
1 parent 4c4f3f2 commit 28fba50

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

aiohttp/abc.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ async def resolve(self, request: Request) -> "AbstractMatchInfo":
6060

6161

6262
class AbstractMatchInfo(ABC):
63+
64+
__slots__ = ()
65+
6366
@property # pragma: no branch
6467
@abstractmethod
6568
def handler(self) -> Callable[[Request], Awaitable[StreamResponse]]:

aiohttp/web_urldispatcher.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,10 @@ async def handle_expect_header(self, request: Request) -> Optional[StreamRespons
249249

250250

251251
class UrlMappingMatchInfo(BaseDict, AbstractMatchInfo):
252-
def __init__(self, match_dict: Dict[str, str], route: AbstractRoute):
252+
253+
__slots__ = ("_route", "_apps", "_current_app", "_frozen")
254+
255+
def __init__(self, match_dict: Dict[str, str], route: AbstractRoute) -> None:
253256
super().__init__(match_dict)
254257
self._route = route
255258
self._apps: List[Application] = []
@@ -311,6 +314,9 @@ def __repr__(self) -> str:
311314

312315

313316
class MatchInfoError(UrlMappingMatchInfo):
317+
318+
__slots__ = ("_exception",)
319+
314320
def __init__(self, http_exception: HTTPException) -> None:
315321
self._exception = http_exception
316322
super().__init__({}, SystemRoute(self._exception))

0 commit comments

Comments
 (0)