summaryrefslogtreecommitdiff
path: root/django/core
diff options
context:
space:
mode:
author93578237 <43147888+93578237@users.noreply.github.com>2026-02-09 16:06:50 -0500
committerJacob Walls <jacobtylerwalls@gmail.com>2026-02-10 16:54:46 -0500
commitdeac58ed822c6cd819e916e6c3d1736c7adfa31e (patch)
tree705f1e46ce13320352804c299509fcf8fa3e27af /django/core
parent254b30483def1fa75270de9f45ad1f2a19f39bdb (diff)
[6.0.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/core')
-rw-r--r--django/core/checks/security/csrf.py5
-rw-r--r--django/core/checks/urls.py5
2 files changed, 4 insertions, 6 deletions
diff --git a/django/core/checks/security/csrf.py b/django/core/checks/security/csrf.py
index d00f2259c6..51be377f48 100644
--- a/django/core/checks/security/csrf.py
+++ b/django/core/checks/security/csrf.py
@@ -1,6 +1,5 @@
-import inspect
-
from django.conf import settings
+from django.utils.inspect import signature
from .. import Error, Tags, Warning, register
@@ -57,7 +56,7 @@ def check_csrf_failure_view(app_configs, **kwargs):
errors.append(Error(msg, id="security.E102"))
else:
try:
- inspect.signature(view).bind(None, reason=None)
+ signature(view).bind(None, reason=None)
except TypeError:
msg = (
"The CSRF failure view '%s' does not take the correct number of "
diff --git a/django/core/checks/urls.py b/django/core/checks/urls.py
index 94bf8f990d..57141bd025 100644
--- a/django/core/checks/urls.py
+++ b/django/core/checks/urls.py
@@ -1,8 +1,8 @@
-import inspect
from collections import Counter
from django.conf import settings
from django.core.exceptions import ViewDoesNotExist
+from django.utils.inspect import signature
from . import Error, Tags, Warning, register
@@ -142,10 +142,9 @@ def check_custom_error_handlers(app_configs, **kwargs):
).format(status_code=status_code, path=path)
errors.append(Error(msg, hint=str(e), id="urls.E008"))
continue
- signature = inspect.signature(handler)
args = [None] * num_parameters
try:
- signature.bind(*args)
+ signature(handler).bind(*args)
except TypeError:
msg = (
"The custom handler{status_code} view '{path}' does not "