import_helper: refactor frozen_modules#3488
Conversation
`frozen_modules` requires non-trivial changes in import (`imp.rs`) and from the doc it is deprecated since 3.3 which makes this feacture unlikely to be support on this project. So instead of implementing this feature, I make `frozen_modules` to raise exception if `frozen` is required. Other than that, all implementation is just like the upstream version (except one TODO comment to remind us there is something not fully supported)
|
|
|
@coolreader18 From grepping this function ( Instead of implementing @contextlib.contextmanager
def frozen_modules(enabled=True):
_imp._override_frozen_modules_for_tests(1 if enabled else -1)
try:
yield
finally:
_imp._override_frozen_modules_for_tests(0)This PR @contextlib.contextmanager
def frozen_modules(enabled=True):
if enabled:
raise NotImplemented("frozen_modules is not implemented on RustPython")
yieldCompared with previous commit, this PR also doesn't change the behavior since the old commit just ignore all function called of |
|
it sounds reasonable to me |
|
Oh yes, me as well, sorry I just didn't have the time to fully review the added code when I first noticed this. LGTM |
frozen_modulesrequires non-trivial changes in import (imp.rs)and from the doc it is deprecated since 3.3 which makes this feacture
unlikely to be support on this project.
So instead of implementing this feature, I make
frozen_modulestoraise exception if
frozenis required. Other than that, all implementationis just like the upstream version (except one TODO comment to remind
us there is something not fully supported)