pschanely / CrossHair

An analysis tool for Python that blurs the line between testing and type systems.
Other
1.03k stars 49 forks source link

Lazy-load function patches #298

Open pschanely opened 3 months ago

pschanely commented 3 months ago

Importing CrossHair transitively imports a ~majority of the standard library, because we register patches for it all. It would be better to register patches only for the currently loaded modules and load other patches just-in-time via some sort of import hook.

This also will fix a failure mode where re-importing a module will break the existing patches. (see heapqlib_test.test_heapify for an example)