Skip to content

Fix global imports in parsed code #75

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

Merged
merged 3 commits into from
Mar 21, 2025

Conversation

ian-coccimiglio
Copy link
Contributor

This PR tries to more closely mirror how Python behaves with module imports. If script_globals and script_locals differ, then global imports will NOT work in parsed code.

I added a test-case to ensure this functions as expected.

Scijava variables are still considered local variables and need to be explicitly imported.

Resolves scijava/scripting-python#3

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@ctrueden
Copy link
Member

Not sure why the CI didn't run, but tests are passing for me locally, so ✔️ !

@ctrueden ctrueden merged commit 07f3af0 into scijava:main Mar 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Python functions in a script do not inherit enclosing scope
2 participants