-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
Open
Labels
OS-windowspendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is providedstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
import sys
from http.server import BaseHTTPRequestHandler, HTTPServer
from typing import NoReturn
def run_server() -> None:
httpd = HTTPServer(("", 0), BaseHTTPRequestHandler)
print("Starting service")
try:
httpd.serve_forever()
except KeyboardInterrupt:
print("Service stopped by ^C")
finally:
httpd.shutdown()
httpd.server_close()
def run() -> NoReturn:
print(f"Python: v{sys.version}")
while True:
try:
input("input>")
except KeyboardInterrupt:
print("^C")
continue
except EOFError:
print("Manually force exit")
sys.exit()
run_server()
if __name__ == "__main__":
run()I'm not sure if it's a bug
Expected
- When
input,^Ccan cancel current input and enter the next cycle - When
server,^Ccan close server and enter the next cycle ^Zto exit (print("Manually force exit"))
Factual
Enterto open server -> type^Cto close server -> type^C- When
py xxx.py,print("Manually force exit") - When
pdb,\.vscode\extensions\ms-python.debugpy-2025.14.1-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_sys_monitoring\_pydevd_sys_monitoring.py", line 873 KeyboardInterrupt
- When
CPython versions tested on:
3.14
Operating systems tested on:
Windows
Metadata
Metadata
Assignees
Labels
OS-windowspendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is providedstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error