summaryrefslogtreecommitdiff
path: root/django/contrib
diff options
context:
space:
mode:
authorJacob Walls <jacobtylerwalls@gmail.com>2025-11-29 18:45:39 -0500
committerJacob Walls <jacobtylerwalls@gmail.com>2025-12-01 20:49:53 -0500
commitec7327453d266d31a00060aeb5b9f19e5adfb0a4 (patch)
tree991b15a8439d4d768ae6256e378b8e2036c2f51e /django/contrib
parent2e3953f0a2de7bb702d393279d9dbbe2581a21a5 (diff)
[6.0.x] Fixed #36712 -- Evaluated type annotations lazily in template tag registration.
Ideally, this will be reverted when an upstream solution is available for https://github.com/python/cpython/issues/141560. Thanks Patrick Rauscher for the report and Augusto Pontes for the first iteration and test. Backport of 34186e731ca20a2344b1f88fd543a854d6b13a00 from main.
Diffstat (limited to 'django/contrib')
-rw-r--r--django/contrib/admin/templatetags/base.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/django/contrib/admin/templatetags/base.py b/django/contrib/admin/templatetags/base.py
index 9551c0e71d..3f8290d3b1 100644
--- a/django/contrib/admin/templatetags/base.py
+++ b/django/contrib/admin/templatetags/base.py
@@ -1,6 +1,7 @@
from inspect import getfullargspec
from django.template.library import InclusionNode, parse_bits
+from django.utils.inspect import lazy_annotations
class InclusionAdminNode(InclusionNode):
@@ -11,9 +12,10 @@ class InclusionAdminNode(InclusionNode):
def __init__(self, parser, token, func, template_name, takes_context=True):
self.template_name = template_name
- params, varargs, varkw, defaults, kwonly, kwonly_defaults, _ = getfullargspec(
- func
- )
+ with lazy_annotations():
+ params, varargs, varkw, defaults, kwonly, kwonly_defaults, _ = (
+ getfullargspec(func)
+ )
bits = token.split_contents()
args, kwargs = parse_bits(
parser,