diff options
| author | 93578237 <43147888+93578237@users.noreply.github.com> | 2026-02-09 16:06:50 -0500 |
|---|---|---|
| committer | Jacob Walls <jacobtylerwalls@gmail.com> | 2026-02-10 17:08:13 -0500 |
| commit | a4999ef1b9790a4c0e793cf0e5c464e9935c3c3a (patch) | |
| tree | f40aea6d8d811cb1ea3e8babc428debd2d175675 /django/template/base.py | |
| parent | e9b85373580338c4878d3f930b52c361398065ad (diff) | |
[5.2.x] Fixed #36903 -- Fixed further NameErrors when inspecting functions with deferred annotations.
Provide a wrapper for safe introspection of user functions on Python 3.14+.
Follow-up to 601914722956cc41f1f2c53972d669ddee6ffc04.
Backport of 56ed37e17e5b1a509aa68a0c797dcff34fcc1366 from main.
Diffstat (limited to 'django/template/base.py')
| -rw-r--r-- | django/template/base.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/django/template/base.py b/django/template/base.py index 5a0941564d..80ccd0d423 100644 --- a/django/template/base.py +++ b/django/template/base.py @@ -58,7 +58,7 @@ from enum import Enum from django.template.context import BaseContext from django.utils.formats import localize from django.utils.html import conditional_escape -from django.utils.inspect import lazy_annotations +from django.utils.inspect import lazy_annotations, signature from django.utils.regex_helper import _lazy_re_compile from django.utils.safestring import SafeData, SafeString, mark_safe from django.utils.text import get_text_list, smart_split, unescape_string_literal @@ -927,12 +927,12 @@ class Variable: current = current() except TypeError: try: - signature = inspect.signature(current) + current_signature = signature(current) except ValueError: # No signature found. current = context.template.engine.string_if_invalid else: try: - signature.bind() + current_signature.bind() except TypeError: # Arguments *were* required. # Invalid method call. current = context.template.engine.string_if_invalid |
