I’ve started drafting the PR and there are two small issues with this approach:
-
Users might already be spelling the option
-X importtime=true
(or with any string). since the value is currently unchecked. This would technically break backwards compatibility; we’re retroactively constraining valid option usage. -
It’s unclear how to validate the corresponding environment value
PYTHONPROFILEIMPORTTIME
: should we error if this isn’t “1” or “2”? Should we only enable cached import tracing if the value is “2”?
While I initially thought augmenting this flag was the best approach, I think adding a new one could markedly simplify these issues