From 7701a8069dbbe6350d39b42d62c79abdf8ccbeac Mon Sep 17 00:00:00 2001 From: Benjamin A. Beasley Date: May 09 2022 20:49:18 +0000 Subject: Incorporate maintainer’s fixes for backported PR#4488 --- diff --git a/fastapi-0.76.0-pr-4819.patch b/fastapi-0.76.0-pr-4819.patch index 07917b0..f766fe7 100644 --- a/fastapi-0.76.0-pr-4819.patch +++ b/fastapi-0.76.0-pr-4819.patch @@ -1,6 +1,6 @@ diff -Naur fastapi-0.76.0-original/fastapi/applications.py fastapi-0.76.0/fastapi/applications.py --- fastapi-0.76.0-original/fastapi/applications.py 2022-05-05 18:26:05.000000000 -0400 -+++ fastapi-0.76.0/fastapi/applications.py 2022-05-06 09:57:52.268000403 -0400 ++++ fastapi-0.76.0/fastapi/applications.py 2022-05-09 16:46:58.701733695 -0400 @@ -1,5 +1,16 @@ from enum import Enum -from typing import Any, Callable, Coroutine, Dict, List, Optional, Sequence, Type, Union @@ -35,33 +35,22 @@ diff -Naur fastapi-0.76.0-original/fastapi/applications.py fastapi-0.76.0/fastap RequestValidationError, request_validation_exception_handler diff -Naur fastapi-0.76.0-original/fastapi/exceptions.py fastapi-0.76.0/fastapi/exceptions.py --- fastapi-0.76.0-original/fastapi/exceptions.py 2022-05-05 18:26:05.000000000 -0400 -+++ fastapi-0.76.0/fastapi/exceptions.py 2022-05-06 09:58:33.240480215 -0400 -@@ -1,20 +1,8 @@ --from typing import Any, Dict, Optional, Sequence, Type -+from typing import Any, Sequence, Type - - from pydantic import BaseModel, ValidationError, create_model - from pydantic.error_wrappers import ErrorList --from starlette.exceptions import HTTPException as StarletteHTTPException -- -- --class HTTPException(StarletteHTTPException): -- def __init__( -- self, -- status_code: int, -- detail: Any = None, -- headers: Optional[Dict[str, Any]] = None, -- ) -> None: ++++ fastapi-0.76.0/fastapi/exceptions.py 2022-05-09 16:48:34.236936512 -0400 +@@ -12,8 +12,9 @@ + detail: Any = None, + headers: Optional[Dict[str, Any]] = None, + ) -> None: - super().__init__(status_code=status_code, detail=detail) - self.headers = headers -- -+from starlette.exceptions import HTTPException as HTTPException # noqa ++ super().__init__( ++ status_code=status_code, detail=detail, headers=headers # type: ignore ++ ) + RequestErrorModel: Type[BaseModel] = create_model("Request") - WebSocketErrorModel: Type[BaseModel] = create_model("WebSocket") diff -Naur fastapi-0.76.0-original/fastapi/routing.py fastapi-0.76.0/fastapi/routing.py --- fastapi-0.76.0-original/fastapi/routing.py 2022-05-05 18:26:05.000000000 -0400 -+++ fastapi-0.76.0/fastapi/routing.py 2022-05-06 09:59:09.578905759 -0400 ++++ fastapi-0.76.0/fastapi/routing.py 2022-05-09 16:46:58.701733695 -0400 @@ -127,7 +127,7 @@ if is_coroutine: value, errors_ = field.validate(response_content, {}, loc=("response",)) @@ -98,7 +87,7 @@ diff -Naur fastapi-0.76.0-original/fastapi/routing.py fastapi-0.76.0/fastapi/rou route.endpoint, diff -Naur fastapi-0.76.0-original/pyproject.toml fastapi-0.76.0/pyproject.toml --- fastapi-0.76.0-original/pyproject.toml 2022-05-05 18:26:05.000000000 -0400 -+++ fastapi-0.76.0/pyproject.toml 2022-05-06 09:59:33.576186782 -0400 ++++ fastapi-0.76.0/pyproject.toml 2022-05-09 16:48:03.046543816 -0400 @@ -35,7 +35,7 @@ "Topic :: Internet :: WWW/HTTP", ] @@ -112,11 +101,11 @@ diff -Naur fastapi-0.76.0-original/pyproject.toml fastapi-0.76.0/pyproject.toml 'ignore:The loop argument is deprecated since Python 3\.8, and scheduled for removal in Python 3\.10:DeprecationWarning:asyncio', # TODO: remove after dropping support for Python 3.6 'ignore:Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography and will be removed in a future release.:UserWarning:jose', -+ 'ignore:starlette.middleware.wsgi is deprecated and will be removed in a future release\..*:DeprecationWarning:starlette' ++ 'ignore:starlette.middleware.wsgi is deprecated and will be removed in a future release\..*:DeprecationWarning:starlette', ] diff -Naur fastapi-0.76.0-original/tests/test_extra_routes.py fastapi-0.76.0/tests/test_extra_routes.py --- fastapi-0.76.0-original/tests/test_extra_routes.py 2022-05-05 18:26:05.000000000 -0400 -+++ fastapi-0.76.0/tests/test_extra_routes.py 2022-05-06 09:59:55.535443938 -0400 ++++ fastapi-0.76.0/tests/test_extra_routes.py 2022-05-09 16:46:58.702733707 -0400 @@ -32,12 +32,12 @@ @app.head("/items/{item_id}") diff --git a/python-fastapi.spec b/python-fastapi.spec index f99c190..7f7b7b2 100644 --- a/python-fastapi.spec +++ b/python-fastapi.spec @@ -29,7 +29,16 @@ BuildArch: noarch # https://github.com/tiangolo/fastapi/pull/4488 # # This version has been rebased to apply to 0.76.0. +# +# Additionally, the maintainer’s fixes to PR#4488 were incorporated: +# +# Fix TOML format +# https://github.com/tiangolo/fastapi/commit/b6003a7c8b7bbd31c6ad03083fe563c5b3fc41bf +# +# Re-implement FastAPI's own HTTPException accepting a dict detail +# https://github.com/tiangolo/fastapi/commit/fd46adb8b13b52f4b11479391364b7e7ed89f47b Patch: fastapi-0.76.0-pr-4819.patch + # Fix sql_app_py39 and py310 tests # https://github.com/tiangolo/fastapi/pull/4409 Patch: %{url}/pull/4409.patch