From: David Lord Date: Tue, 23 Apr 2024 19:09:23 +0000 (-0700) Subject: drop support for Python 3.7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fcd3d3bbf38544c60984e3bfbac8b813d48721e4;p=thirdparty%2Fjinja.git drop support for Python 3.7 --- diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index c5e5f709..91a02d0c 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -28,7 +28,6 @@ jobs: - {python: '3.10'} - {python: '3.9'} - {python: '3.8'} - - {python: '3.7'} - {name: PyPy, python: 'pypy-3.10', tox: pypy310} steps: - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 diff --git a/CHANGES.rst b/CHANGES.rst index eb46957d..12696825 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,6 +5,7 @@ Version 3.2.0 Unreleased +- Drop support for Python 3.7. - Use modern packaging metadata with ``pyproject.toml`` instead of ``setup.cfg``. :pr:`1793` - Use ``flit_core`` instead of ``setuptools`` as build backend. diff --git a/docs/intro.rst b/docs/intro.rst index fd6f84ff..de8b0a34 100644 --- a/docs/intro.rst +++ b/docs/intro.rst @@ -30,7 +30,7 @@ Installation ------------ We recommend using the latest version of Python. Jinja supports Python -3.7 and newer. We also recommend using a `virtual environment`_ in order +3.8 and newer. We also recommend using a `virtual environment`_ in order to isolate your project dependencies from other projects and the system. .. _virtual environment: https://packaging.python.org/tutorials/installing-packages/#creating-virtual-environments diff --git a/pyproject.toml b/pyproject.toml index 7f56da39..77ff9df2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,7 @@ classifiers = [ "Topic :: Text Processing :: Markup :: HTML", "Typing :: Typed", ] -requires-python = ">=3.7" +requires-python = ">=3.8" dependencies = ["MarkupSafe>=2.0"] dynamic = ["version"] diff --git a/src/jinja2/debug.py b/src/jinja2/debug.py index 7ed7e929..9fda24ca 100644 --- a/src/jinja2/debug.py +++ b/src/jinja2/debug.py @@ -118,26 +118,7 @@ def fake_traceback( # type: ignore elif function.startswith("block_"): location = f"block {function[6:]!r}" - if sys.version_info >= (3, 8): - code = code.replace(co_name=location) - else: - code = CodeType( - code.co_argcount, - code.co_kwonlyargcount, - code.co_nlocals, - code.co_stacksize, - code.co_flags, - code.co_code, - code.co_consts, - code.co_names, - code.co_varnames, - code.co_filename, - location, - code.co_firstlineno, - code.co_lnotab, - code.co_freevars, - code.co_cellvars, - ) + code = code.replace(co_name=location) # Execute the new code, which is guaranteed to raise, and return # the new traceback without this frame. diff --git a/src/jinja2/ext.py b/src/jinja2/ext.py index 8d0810cd..9fad0aa1 100644 --- a/src/jinja2/ext.py +++ b/src/jinja2/ext.py @@ -289,28 +289,12 @@ class InternationalizationExtension(Extension): import gettext translations = gettext.NullTranslations() - - if hasattr(translations, "pgettext"): - # Python < 3.8 - pgettext = translations.pgettext - else: - - def pgettext(c: str, s: str) -> str: # type: ignore[misc] - return s - - if hasattr(translations, "npgettext"): - npgettext = translations.npgettext - else: - - def npgettext(c: str, s: str, p: str, n: int) -> str: # type: ignore[misc] - return s if n == 1 else p - self._install_callables( gettext=translations.gettext, ngettext=translations.ngettext, newstyle=newstyle, - pgettext=pgettext, - npgettext=npgettext, + pgettext=translations.pgettext, + npgettext=translations.npgettext, ) def _install_callables( diff --git a/tox.ini b/tox.ini index 6582e281..f7bc0b3b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist = - py3{12,11,10,9,8,7} + py3{12,11,10,9,8} pypy310 style typing