Python 3.14: Update cheroot workaround

https://github.com/cherrypy/cheroot/issues/734
https://github.com/python/cpython/issues/129354
Part of #8529
This commit is contained in:
Florian Bruhin 2025-04-02 12:52:24 +02:00
parent c165d1a0da
commit 163bb9fa0c
1 changed files with 14 additions and 2 deletions

View File

@ -341,7 +341,7 @@ class WSGIServer(cheroot.wsgi.Server):
def unraisable_hook(unraisable: "sys.UnraisableHookArgs") -> None:
if (
sys.version_info[:2] == (3, 13)
sys.version_info[:2] >= (3, 13)
and isinstance(unraisable.exc_value, OSError)
and (
unraisable.exc_value.errno == errno.EBADF
@ -351,7 +351,19 @@ def unraisable_hook(unraisable: "sys.UnraisableHookArgs") -> None:
and unraisable.exc_value.winerror == errno.WSAENOTSOCK
)
)
and unraisable.object.__qualname__ == "IOBase.__del__"
and (
(
# Python 3.14
unraisable.object is None
and unraisable.err_msg.startswith(
"Exception ignored while calling deallocator <function IOBase.__del__ at "
)
)
or (
unraisable.object is not None
and unraisable.object.__qualname__ == "IOBase.__del__"
)
)
):
# WORKAROUND for bogus exceptions with cheroot:
# https://github.com/cherrypy/cheroot/issues/734