bpo-21862: Add -m option to cProfile for profiling modules by CuriousLearner · Pull Request #4297 · python/cpython (original) (raw)

Choose a reason for hiding this comment

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

@pitrou is right, and the missing !r was just a bug in my suggested code. However, there's merit in the idea of using just one mechanism for passing values in (the globs dict) rather than two (string interpolation and the globs dict).

So while I still think it makes sense to pass in a reference to the run_module itself, rather than one to the runpy module, I withdraw the suggestion of using string interpolation to pass in the module name to run.