Skip to content

Conversation

dschult
Copy link
Member

@dschult dschult commented Nov 27, 2023

As part of DelayedImportErrorModule, an exception message is created for ModuleNotFound. That message creation uses __frame_data including code_context. But it raises a secondary TypeError exception if fd["code_context'] is None.

This PR handles the case of no code_context by adding or "" to get fd["code_context"] or ""
See networkx/networkx#7062

I wasn't able to make a test for this easily because I don't know how to create some code for a test with code_context showing up as None. But this change is presumably harmless at worst and hopes to reduce confusion when a moduleNotFound error is raised for a DelayedImportErrorModule.

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (fbd805b) 93.95% compared to head (0ece17a) 93.95%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@ Coverage Diff @@ ## main #83 +/- ## ======================================= Coverage 93.95% 93.95% ======================================= Files 4 4 Lines 182 182 ======================================= Hits 171 171 Misses 11 11 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@stefanv stefanv added the type: Bug fix Something isn't working label Jan 25, 2024
@stefanv stefanv merged commit bf82b68 into scientific-python:main Jan 25, 2024
@stefanv
Copy link
Member

stefanv commented Jan 25, 2024

Thanks @dschult!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: Bug fix Something isn't working
4 participants