pschanely / CrossHair

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

Lazy-load function patches #298

Open pschanely opened 1 month ago

pschanely commented 1 month 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)