A router cannot stop when it has circular references. #11424
-
First Check
Commit to Help
Example Codefrom fastapi import APIRouter, FastAPI
app = FastAPI()
api = APIRouter(prefix="/api")
@api.post("/foobar")
def foobar():
return {"foo": "bar"}
# I made a typo where I should have written `app.include_router(api)`.
api.include_router(api)DescriptionBecause of the circular reference caused by However, when executing this code, it becomes impossible to exit the infinite loop that uvicorn falls into. Operating SystemmacOS Operating System DetailsNo response FastAPI Version0.110.1 Pydantic Version2.6.4 Python VersionPython 3.12.2 Additional ContextIf your server doesn't start in an infinite loop, there's a possibility that the phenomenon described in this discussion is occurring. |
Beta Was this translation helpful? Give feedback.
Answered by
JavierSanchezCastro
Apr 11, 2024
Replies: 1 comment 2 replies
-
|
I've created a PR #11425, is that what are you looking for? (It's not working, but to get the idea) |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
ofk
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've created a PR #11425, is that what are you looking for? (It's not working, but to get the idea)