From e0771b7f2578a62c6b382898241b6f1bae661c44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20S=C3=A1nchez=20Castro?= <72013291+JavierSanchezCastro@users.noreply.github.com> Date: Thu, 11 Apr 2024 23:36:58 +0100 Subject: [PATCH] Update routing.py Compare id --- fastapi/routing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastapi/routing.py b/fastapi/routing.py index 8842745bd..13ccf9ab9 100644 --- a/fastapi/routing.py +++ b/fastapi/routing.py @@ -1204,7 +1204,7 @@ class APIRouter(routing.Router): app.include_router(internal_router) ``` """ - assert self != router, "Router cannot be the same as parent" + assert id(self) != id(router), "Router cannot be the same as parent" if prefix: assert prefix.startswith("/"), "A path prefix must start with '/'" assert not prefix.endswith(