dd-trace-py icon indicating copy to clipboard operation
dd-trace-py copied to clipboard

fix(internal): chained namespace loader [backport #8603 to 2.4]

Open P403n1x87 opened this issue 1 year ago • 2 comments
trafficstars

Backport of #8603 to 2.4

We fix the implemention of the support for namespace module imports that caused issues with some standard library modules, such as importlib. We make sure that the internal module attribute initialisation can create the correct namespace loader, and then we make sure that we chain it with the custom loader used to trigger import hooks.

Addresses #8003

Checklist

  • [x] Change(s) are motivated and described in the PR description
  • [x] Testing strategy is described if automated tests are not included in the PR
  • [x] Risks are described (performance impact, potential for breakage, maintainability)
  • [x] Change is maintainable (easy to change, telemetry, documentation)
  • [x] Library release note guidelines are followed or label changelog/no-changelog is set
  • [x] Documentation is included (in-code, generated user docs, public corp docs)
  • [x] Backport labels are set (if applicable)
  • [x] If this PR changes the public interface, I've notified @DataDog/apm-tees.
  • [x] If change touches code that signs or publishes builds or packages, or handles credentials of any kind, I've requested a review from @DataDog/security-design-and-guidance.

Reviewer Checklist

  • [x] Title is accurate
  • [x] All changes are related to the pull request's stated goal
  • [x] Description motivates each change
  • [x] Avoids breaking API changes
  • [x] Testing strategy adequately addresses listed risks
  • [x] Change is maintainable (easy to change, telemetry, documentation)
  • [x] Release note makes sense to a user of the library
  • [x] Author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment
  • [x] Backport labels are set in a manner that is consistent with the release branch maintenance policy

P403n1x87 avatar Mar 06 '24 15:03 P403n1x87

Datadog Report

Branch report: backport-8603-to-2.4 Commit report: f0fadf8 Test service: dd-trace-py

:white_check_mark: 0 Failed, 11344 Passed, 85750 Skipped, 3h 49m 23.93s Total duration (8h 15m 39.5s time saved)

@P403n1x87 2.4 is outside of the backport policy at this point, so we can skip this unless you've got a specific reason to put it into 2.4.

emmettbutler avatar Mar 06 '24 18:03 emmettbutler