py313: Suppress cheroot warnings
https://github.com/cherrypy/cheroot/issues/734 See #8205
This commit is contained in:
parent
48d3c7d97c
commit
4c7325f912
|
|
@ -12,6 +12,7 @@ parameters or headers with the same name properly.
|
|||
"""
|
||||
|
||||
import sys
|
||||
import errno
|
||||
import json
|
||||
import time
|
||||
import threading
|
||||
|
|
@ -338,7 +339,26 @@ class WSGIServer(cheroot.wsgi.Server):
|
|||
self._ready = value
|
||||
|
||||
|
||||
def unraisable_hook(unraisable: "sys.UnraisableHookArgs") -> None:
|
||||
if (
|
||||
sys.version_info[:2] == (3, 13)
|
||||
and isinstance(unraisable.exc_value, OSError)
|
||||
and unraisable.exc_value.errno == errno.EBADF
|
||||
and unraisable.object.__qualname__ == "IOBase.__del__"
|
||||
):
|
||||
# WORKAROUND for bogus exceptions with cheroot:
|
||||
# https://github.com/cherrypy/cheroot/issues/734
|
||||
return
|
||||
sys.__unraisablehook__(unraisable)
|
||||
|
||||
|
||||
def init_unraisable_hook() -> None:
|
||||
sys.unraisablehook = unraisable_hook
|
||||
|
||||
|
||||
def main():
|
||||
init_unraisable_hook()
|
||||
|
||||
app.template_folder = END2END_DIR / 'templates'
|
||||
assert app.template_folder.is_dir(), app.template_folder
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,8 @@ def log_request(response):
|
|||
|
||||
|
||||
def main():
|
||||
webserver_sub.init_unraisable_hook()
|
||||
|
||||
port = int(sys.argv[1])
|
||||
server = webserver_sub.WSGIServer(('127.0.0.1', port), app)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue