]> git.ipfire.org Git - thirdparty/jinja.git/commitdiff
drop support for Python 3.7
authorDavid Lord <davidism@gmail.com>
Tue, 23 Apr 2024 19:09:23 +0000 (12:09 -0700)
committerDavid Lord <davidism@gmail.com>
Tue, 23 Apr 2024 19:22:59 +0000 (12:22 -0700)
.github/workflows/tests.yaml
CHANGES.rst
docs/intro.rst
pyproject.toml
src/jinja2/debug.py
src/jinja2/ext.py
tox.ini

index c5e5f709a270a0ab24507d5e7eecde67989e9c4c..91a02d0caf03975e86194d2b8b169aaeb3b9c74d 100644 (file)
@@ -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
index eb46957df95805637b97720db5633e4c48a19183..1269682581c790e76f47eddeee60f43f0374119b 100644 (file)
@@ -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.
index fd6f84ff5beb77324c5d4a7fa66049b73b6003de..de8b0a341aaf937c15a0e399f725a82f4ab55745 100644 (file)
@@ -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
index 7f56da3933e9e900797de417018ff57d0a529138..77ff9df25d005c27ea3dccf7897d2a624ec43078 100644 (file)
@@ -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"]
 
index 7ed7e9297e01b87c4e999d19d48a4265b38b574f..9fda24caa475f8b3e9ef2f49c8346d14278f64fe 100644 (file)
@@ -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.
index 8d0810cd48025ec0ab46ae7ac4e930bf2731f7fe..9fad0aa19608f2284b7518baf8e9a9fa0f28c91d 100644 (file)
@@ -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 6582e2812f55795cebea74a5cc2c0e141da736fa..f7bc0b3b5c611595eb0452b5fd48393c16de27d2 100644 (file)
--- 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