refactor(django): correct debug unpatch target#17233
refactor(django): correct debug unpatch target#17233KowalskiThomas wants to merge 1 commit intomainfrom
Conversation
Codeowners resolved as |
Co-authored-by: KowalskiThomas <14239160+KowalskiThomas@users.noreply.github.com>
a24433e to
2a0afbc
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2a0afbc0df
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| trace_utils.unwrap(django.contrib.auth.login, "login") | ||
| trace_utils.unwrap(django.contrib.auth.authenticate, "authenticate") | ||
| trace_utils.unwrap(django.view.debug.technical_500_response, "technical_500_response") | ||
| trace_utils.unwrap(django.views.debug.technical_500_response, "technical_500_response") |
There was a problem hiding this comment.
Unwrap the debug module instead of the wrapped function
trace_utils.unwrap expects a container object and an attribute name (see ddtrace/internal/utils/wrappers.py), but this call passes django.views.debug.technical_500_response itself as the container. In real unpatch flows this leads to getattr(function, "technical_500_response") and can still raise AttributeError, so unpatch cleanup remains broken despite the view→views fix. The first argument should be the module (django.views.debug), not the function object.
Useful? React with 👍 / 👎.
Description
This fixes a Django integration unpatch bug where
_unpatchreferenceddjango.view.debug(non-existent), which can raiseAttributeErrorduring unpatch and prevent proper cleanup.ddtrace/contrib/internal/django/patch.pyto unwrapdjango.views.debug.technical_500_response.tests/contrib/django/test_django_patch.pyto verify_unpatchtargetsdjango.views.debug.technical_500_response.