-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Closed
Labels
Description
First check
- I added a very descriptive title to this issue.
- I used the GitHub search to find a similar issue and didn't find it.
- I searched the FastAPI documentation, with the integrated search.
- I already searched in Google "How to X in FastAPI" and didn't find any information.
- I already read and followed all the tutorials in the docs and didn't find an answer.
- I already checked if it is not related to FastAPI but to Pydantic.
- I already checked if it is not related to FastAPI but to Swagger UI.
- I already checked if it is not related to FastAPI but to ReDoc.
- After submitting this, I commit to one of:
- Read open issues with questions until I find 2 issues where I can help someone and add a comment to help there.
- I already hit the "watch" button in this repository to receive notifications and I commit to help at least 2 people that ask
Description
I have this issue on my QA server, but I was not able to replicate it locally.
My code based on the latest version of https://github.com/tiangolo/full-stack-fastapi-postgresql using the base class in CRUD,
this error happened on the update function
Fatal Python error: Cannot recover from stack overflow.
Thread 0x00007f615d0c0700 (most recent call first):
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 78 in _worker
File "/usr/local/lib/python3.7/threading.py", line 870 in run
File "/usr/local/lib/python3.7/threading.py", line 926 in _bootstrap_inner
File "/usr/local/lib/python3.7/threading.py", line 890 in _bootstrap
Thread 0x00007f615d8c1700 (most recent call first):
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 78 in _worker
File "/usr/local/lib/python3.7/threading.py", line 870 in run
File "/usr/local/lib/python3.7/threading.py", line 926 in _bootstrap_inner
File "/usr/local/lib/python3.7/threading.py", line 890 in _bootstrap
Current thread 0x00007f615e19f700 (most recent call first):
File "<string>", line 1 in <lambda>
File "/usr/local/lib/python3.7/site-packages/sqlalchemy/sql/operators.py", line 432 in __getitem__
Environment
- OS: [e.g. Linux / Windows / macOS]: ubuntu
- FastAPI Version [e.g. 0.3.0]: 0.61.0
- Python version: 3.7
Additional context
def update(self, db: Session, *, db_obj: ModelType, obj_in: Union[UpdateSchemaType, Dict[str, Any]]) -> ModelType:
obj_data = jsonable_encoder(db_obj)
if isinstance(obj_in, dict):
update_data = obj_in
else:
update_data = obj_in.dict(exclude_unset=True)
for field in obj_data:
if field in update_data:
setattr(db_obj, field, update_data[field])
db.add(db_obj)
db.commit()
db.refresh(db_obj)
return db_obj
Reactions are currently unavailable