bpo-46433: _PyType_GetModuleByDef: handle static types in MRO by encukou · Pull Request #30696 · python/cpython (original) (raw)
Ah, turns out I won't be able to optimize this further. _PyType_GetModuleByDef
is currently called on static types, so the flag needs to be checked.
Removing the calls to _PyType_GetModuleByDef
on static types isn't feasible IMO: it's too easy to miss the requirement in the future.
@vstinner, since you did the optimization, could you look at this code? Did I miss something performance-related?