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

plugins.handlers: fix some PyFilePlugin logic errors #2633

Merged
merged 2 commits into from
Oct 20, 2024

Conversation

dgw
Copy link
Member

@dgw dgw commented Oct 18, 2024

Description

This fixes submodule search locations for PyFilePlugins, checks whether the module spec is valid before adding it to sys.modules (instead of checking after), and adds a regression test for the submodule search location fix.

Fixing submodule_search_locations resolves #2619.

Checklist

  • I have read CONTRIBUTING.md
  • I can and do license this contribution under the EFLv2
  • No issues are reported by make qa (runs make lint and make test)
  • I have tested the functionality of the things this change touches

Two things:

1. `submodule_search_locations` is expected to be a list, according to
   Python's documentation for `importlib.machinery.ModuleSpec`.
2. The new `module` being inserted into `sys.modules` before checking if
   its spec had a valid `loader` bothered me, so I reordered the steps.
@dgw dgw added Tweak Bugfix Generally, PRs that reference (and fix) one or more issue(s) labels Oct 18, 2024
@dgw dgw added this to the 8.0.1 milestone Oct 18, 2024
@dgw dgw requested a review from a team October 18, 2024 21:40
@dgw dgw mentioned this pull request Oct 18, 2024
4 tasks
Copy link
Contributor

@Exirel Exirel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to approve because technically that's what we want. I'd feel better with the added assert but it's not absolutely necessary.

test/plugins/test_plugins_handlers.py Show resolved Hide resolved
@dgw dgw force-pushed the plugins.handlers-tweaks branch from a5fd1fe to 54372e6 Compare October 20, 2024 16:13
@dgw dgw merged commit 3f7d0c3 into master Oct 20, 2024
17 checks passed
@dgw dgw deleted the plugins.handlers-tweaks branch October 20, 2024 16:19
dgw added a commit that referenced this pull request Oct 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bugfix Generally, PRs that reference (and fix) one or more issue(s) Tweak
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ModuleNotFoundError on relative import in folder plugin
2 participants