Fix Issue #6129 unexpected `__env__`  keyword

Re-implement 06ac67c the right way since the state `__env__` was being confused by the shell environment.