Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(internal): handle additional attributes in module watchdog #4049

Merged
merged 5 commits into from
Aug 10, 2022

Conversation

P403n1x87
Copy link
Contributor

@P403n1x87 P403n1x87 commented Aug 4, 2022

Description

PEP 302 documents additional optional methods for the loader. This change adds support for them by proxying attribute requests to the underlying loader instance, when not specifically overridden. The __class__ attribute is also handled specially to allow isinstance to believe that instances of the module watchdog loader are also instances of the underlying actual loader. This is required by some tools, e.g. slotscheck, that can handle only certain known types of loader (e.g. those that come with the Python stdlib).

Checklist

Reviewer Checklist

  • Title is accurate.
  • Description motivates each change.
  • No unnecessary changes were introduced in this PR.
  • PR cannot be broken up into smaller PRs.
  • Avoid breaking API changes unless absolutely necessary.
  • Tests provided or description of manual testing performed is included in the code or PR.
  • Release note has been added for fixes and features, or else changelog/no-changelog label added.
  • All relevant GitHub issues are correctly linked.
  • Backports are identified and tagged with Mergifyio.
  • Add to milestone.

PEP 302 documents the optional method get_data for the loader. This
change adds support for that method to the module watchdog import hook
system.
@P403n1x87 P403n1x87 added the changelog/no-changelog A changelog entry is not required for this PR. label Aug 4, 2022
@P403n1x87 P403n1x87 requested a review from a team as a code owner August 4, 2022 16:03
mabdinur
mabdinur previously approved these changes Aug 4, 2022
ddtrace/internal/module.py Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

Codecov Report

Merging #4049 (480efeb) into 1.x (e618c0f) will decrease coverage by 0.76%.
The diff coverage is 49.40%.

❗ Current head 480efeb differs from pull request most recent head 2c02503. Consider uploading reports for the commit 2c02503 to get more accurate results

@@            Coverage Diff             @@
##              1.x    #4049      +/-   ##
==========================================
- Coverage   79.86%   79.10%   -0.77%     
==========================================
  Files         717      718       +1     
  Lines       56347    56717     +370     
==========================================
- Hits        45004    44865     -139     
- Misses      11343    11852     +509     
Impacted Files Coverage Δ
ddtrace/contrib/flask/patch.py 0.00% <0.00%> (ø)
ddtrace/contrib/pylons/middleware.py 87.05% <ø> (ø)
tests/contrib/django/django_app/settings.py 100.00% <ø> (ø)
tests/contrib/django/test_django.py 100.00% <ø> (ø)
tests/contrib/flask/test_flask_appsec.py 0.00% <0.00%> (ø)
tests/contrib/flask/test_flask_snapshot.py 0.00% <0.00%> (ø)
tests/contrib/flask/test_hooks.py 0.00% <0.00%> (ø)
tests/contrib/flask/test_request.py 0.00% <0.00%> (ø)
tests/contrib/flask/test_static.py 0.00% <0.00%> (ø)
tests/contrib/flask/test_template.py 0.00% <0.00%> (ø)
... and 30 more

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@P403n1x87 P403n1x87 changed the title chore(internal): handle get_data in module watchdog chore(internal): handle additional attributes in module watchdog Aug 10, 2022
@P403n1x87 P403n1x87 requested review from mabdinur and a team August 10, 2022 13:50
@mergify mergify bot merged commit 3f6d30b into DataDog:1.x Aug 10, 2022
@P403n1x87 P403n1x87 deleted the chore/module-handle-get-data branch August 10, 2022 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog/no-changelog A changelog entry is not required for this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants