From a7964367f7978986bbc752a7d5e0e4f0d73896e7 Mon Sep 17 00:00:00 2001 From: nurseomit <131279907+nurseomit@users.noreply.github.com> Date: Wed, 19 Apr 2023 16:57:37 +0200 Subject: [PATCH 1/4] Update _subprocess.py [Montag 15:19] Fassel Andreas (BSH GDS-BCL3) If you start uvicorn in the context of Windows IIS10 no stdin exists, but exception is not OSError, but AttributeError with uvicorn-0.21.1.dist-info --- uvicorn/_subprocess.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uvicorn/_subprocess.py b/uvicorn/_subprocess.py index e05473c72..a1f5a1636 100644 --- a/uvicorn/_subprocess.py +++ b/uvicorn/_subprocess.py @@ -35,7 +35,7 @@ def get_subprocess( stdin_fileno: Optional[int] try: stdin_fileno = sys.stdin.fileno() - except OSError: + except (AttributeError, OSError): stdin_fileno = None kwargs = { From 0d002258f0a6b402cff17c07b9da4f3d86ff7109 Mon Sep 17 00:00:00 2001 From: Marcelo Trylesinski Date: Thu, 29 Feb 2024 13:36:21 -0700 Subject: [PATCH 2/4] Update uvicorn/_subprocess.py --- uvicorn/_subprocess.py | 1 + 1 file changed, 1 insertion(+) diff --git a/uvicorn/_subprocess.py b/uvicorn/_subprocess.py index 5546beecd..013b9a8ae 100644 --- a/uvicorn/_subprocess.py +++ b/uvicorn/_subprocess.py @@ -37,6 +37,7 @@ def get_subprocess( stdin_fileno: Optional[int] try: stdin_fileno = sys.stdin.fileno() + # The `sys.stdin` can be `None`, see https://docs.python.org/3/library/sys.html#sys.__stdin__. except (AttributeError, OSError): stdin_fileno = None From 36c8ee00d44d658b5eca1198178dc08e8a31a6d8 Mon Sep 17 00:00:00 2001 From: Marcelo Trylesinski Date: Thu, 29 Feb 2024 13:43:49 -0700 Subject: [PATCH 3/4] Update uvicorn/_subprocess.py --- uvicorn/_subprocess.py | 1 - 1 file changed, 1 deletion(-) diff --git a/uvicorn/_subprocess.py b/uvicorn/_subprocess.py index 013b9a8ae..1bb493205 100644 --- a/uvicorn/_subprocess.py +++ b/uvicorn/_subprocess.py @@ -34,7 +34,6 @@ def get_subprocess( """ # We pass across the stdin fileno, and reopen it in the child process. # This is required for some debugging environments. - stdin_fileno: Optional[int] try: stdin_fileno = sys.stdin.fileno() # The `sys.stdin` can be `None`, see https://docs.python.org/3/library/sys.html#sys.__stdin__. From 1f6b0da398951ddcdacf1c0dc3bbfbd0b7690727 Mon Sep 17 00:00:00 2001 From: Marcelo Trylesinski Date: Thu, 29 Feb 2024 13:47:43 -0700 Subject: [PATCH 4/4] Update _subprocess.py --- uvicorn/_subprocess.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uvicorn/_subprocess.py b/uvicorn/_subprocess.py index 1bb493205..5eb835327 100644 --- a/uvicorn/_subprocess.py +++ b/uvicorn/_subprocess.py @@ -9,7 +9,7 @@ import sys from multiprocessing.context import SpawnProcess from socket import socket -from typing import Callable, Optional +from typing import Callable from uvicorn.config import Config