FastAPI 0.123.5 breaks async wrappers using @wraps #14442
-
First Check
Commit to Help
Example Codefrom functools import wraps
import uvicorn
from fastapi import FastAPI
app = FastAPI()
def my_decorator(func):
"""A decorator that wraps a sync function with an async handler."""
@wraps(func)
async def wrapper():
func()
return 'OK'
return wrapper
@app.get('/')
@my_decorator
def index():
"""A simple sync page function."""
print('Hello!')
if __name__ == '__main__':
uvicorn.run(app)Description
Since FastAPI 0.123.5 (PR #14434), using The issue is that Operating SystemmacOS Operating System DetailsNo response FastAPI Version0.123.5 Pydantic Version2.12.5 Python Version3.11.11 Additional ContextNo response |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
|
Sorry, I just noticed that the problem is already being discussed on PR #14434 itself. |
Beta Was this translation helpful? Give feedback.
This should be fixed by #14448
It's now released in FastAPI 0.123.6 🎉