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:51:55 -0500
commit56ed37e17e5b1a509aa68a0c797dcff34fcc1366 (patch)
treed1f91ee3a83506992ccbd7994636e9b8d68314e9 /django/core
parent2c2d36376a0ce0edc048c077a60be6e3b953bb09 (diff)
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.
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 dee29384ee..a4d03b5abb 100644
--- a/django/core/checks/security/csrf.py
+++ b/django/core/checks/security/csrf.py
@@ -1,7 +1,6 @@
-import inspect
-
from django.conf import settings
from django.core.checks import Error, Tags, Warning, register
+from django.utils.inspect import signature
W003 = Warning(
"You don't appear to be using Django's built-in "
@@ -56,7 +55,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 "