From e12362681a958711e5430d2de8da8b82ee26a5bf Mon Sep 17 00:00:00 2001 From: David Lord Date: Sat, 11 May 2024 10:02:40 -0700 Subject: [PATCH] test with python 3.13 --- .github/workflows/tests.yaml | 1 + pyproject.toml | 3 --- requirements/dev.txt | 4 +--- requirements/tests.in | 3 ++- requirements/tests.txt | 8 ++++---- src/werkzeug/debug/tbtools.py | 15 +++++++++++++-- tox.ini | 2 +- 7 files changed, 22 insertions(+), 14 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 91a02d0ca..fb2629019 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -21,6 +21,7 @@ jobs: fail-fast: false matrix: include: + - {python: '3.13'} - {python: '3.12'} - {name: Windows, python: '3.12', os: windows-latest} - {name: Mac, python: '3.12', os: macos-latest} diff --git a/pyproject.toml b/pyproject.toml index eb06882df..600feb31e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -79,9 +79,6 @@ strict = true module = [ "colorama.*", "cryptography.*", - "eventlet.*", - "gevent.*", - "greenlet.*", "watchdog.*", "xprocess.*", ] diff --git a/requirements/dev.txt b/requirements/dev.txt index 186ceda46..91aac67eb 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -18,7 +18,7 @@ certifi==2024.2.2 # via # -r docs.txt # requests -cffi==1.16.0 +cffi @ https://github.com/python-cffi/cffi/archive/d7f750b1b1c5ea4da5aa537b9baba0e01b0ce843.zip # via # -r tests.txt # cryptography @@ -46,8 +46,6 @@ filelock==3.13.3 # via # tox # virtualenv -greenlet==3.0.3 - # via -r tests.txt identify==2.5.35 # via pre-commit idna==3.6 diff --git a/requirements/tests.in b/requirements/tests.in index 8228f8ee6..26263e3c0 100644 --- a/requirements/tests.in +++ b/requirements/tests.in @@ -3,6 +3,7 @@ pytest-timeout # pinned for python 3.8 support pytest-xprocess<1 cryptography -greenlet watchdog ephemeral-port-reserve +# pin current commit on main for python 3.13 support +https://github.com/python-cffi/cffi/archive/d7f750b1b1c5ea4da5aa537b9baba0e01b0ce843.zip diff --git a/requirements/tests.txt b/requirements/tests.txt index 14b67436f..c1d236b94 100644 --- a/requirements/tests.txt +++ b/requirements/tests.txt @@ -4,14 +4,14 @@ # # pip-compile tests.in # -cffi==1.16.0 - # via cryptography +cffi @ https://github.com/python-cffi/cffi/archive/d7f750b1b1c5ea4da5aa537b9baba0e01b0ce843.zip + # via + # -r tests.in + # cryptography cryptography==42.0.5 # via -r tests.in ephemeral-port-reserve==1.1.4 # via -r tests.in -greenlet==3.0.3 - # via -r tests.in iniconfig==2.0.0 # via pytest packaging==24.0 diff --git a/src/werkzeug/debug/tbtools.py b/src/werkzeug/debug/tbtools.py index 0574c966b..e81ed6e18 100644 --- a/src/werkzeug/debug/tbtools.py +++ b/src/werkzeug/debug/tbtools.py @@ -296,7 +296,12 @@ def render_traceback_html(self, include_title: bool = True) -> str: rows.append("\n".join(row_parts)) - is_syntax_error = issubclass(self._te.exc_type, SyntaxError) + if sys.version_info < (3, 13): + exc_type_str = self._te.exc_type.__name__ + else: + exc_type_str = self._te.exc_type_str + + is_syntax_error = exc_type_str == "SyntaxError" if include_title: if is_syntax_error: @@ -325,13 +330,19 @@ def render_debugger_html( ) -> str: exc_lines = list(self._te.format_exception_only()) plaintext = "".join(self._te.format()) + + if sys.version_info < (3, 13): + exc_type_str = self._te.exc_type.__name__ + else: + exc_type_str = self._te.exc_type_str + return PAGE_HTML % { "evalex": "true" if evalex else "false", "evalex_trusted": "true" if evalex_trusted else "false", "console": "false", "title": escape(exc_lines[0]), "exception": escape("".join(exc_lines)), - "exception_type": escape(self._te.exc_type.__name__), + "exception_type": escape(exc_type_str), "summary": self.render_traceback_html(include_title=False), "plaintext": escape(plaintext), "plaintext_cs": re.sub("-{2,}", "-", plaintext), diff --git a/tox.ini b/tox.ini index f7bc0b3b5..708c2295a 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist = - py3{12,11,10,9,8} + py3{13,12,11,10,9,8} pypy310 style typing