Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Namespace-wrap the
createvirtualnamespace
call
Also fix `ut_repyv2api_virtualnamespacecontextsafety.py` to test the proper functionality. (Following the namespace-wrap, it exhibited an issue in in `namespace.py` which we need to discuss separately, see SeattleTestbed#126) Details about namespace wrapping: * In `repy.py`, remove the addition of the non-wrapped `getresources` call to `usercontext`. (The properly wrapped definition was implemented in `namespace.py`'s `USERCONTEXT_WRAPPER_INFO` already, but `repy.py` overrode it.) * In `namespace.py`, change the `SafeDict*` processors to inherit from class `ValueProcessor` rather than `ObjectProcessor`. This follows what the `Dict` processor does, and fixes the `virtualnamespace-eval` and `virtualnamespacecontextsafety` unit tests that failed with unwrapping errors when supplying a `dict` / `SafeDict` to the `VirtualNamespace` to be evaluated. The particular unit test errors were artifacts of how the `SafeDict*` processors inherited from `ObjectProcessor`, and looked like this: """ Running: ut_repyv2api_virtualnamespace-eval.py [ FAIL ] -------------------------------------------------------------------------------- Standard error : ..............................Produced.............................. Internal Error --- Uncaught exception! --- Following is a full traceback, and a user traceback. The user traceback excludes non-user modules. The most recent call is displayed last. Full debugging traceback: "/private/tmp/repy_v2/RUNNABLE/namespace.py", line 1194, in wrapped_function "/private/tmp/repy_v2/RUNNABLE/namespace.py", line 1095, in _process_args "/private/tmp/repy_v2/RUNNABLE/namespace.py", line 283, in unwrap User traceback: Exception (with type 'exceptions.AttributeError'): SafeDict instance has no attribute '_wrapped__object' --- ..............................Expected.............................. None -------------------------------------------------------------------------------- Running: ut_repyv2api_virtualnamespacecontextsafety.py [ FAIL ] -------------------------------------------------------------------------------- Standard error : ..............................Produced.............................. Internal Error --- Uncaught exception! --- Following is a full traceback, and a user traceback. The user traceback excludes non-user modules. The most recent call is displayed last. Full debugging traceback: "/private/tmp/repy_v2/RUNNABLE/namespace.py", line 1194, in wrapped_function "/private/tmp/repy_v2/RUNNABLE/namespace.py", line 1095, in _process_args "/private/tmp/repy_v2/RUNNABLE/namespace.py", line 283, in unwrap User traceback: Exception (with type 'exceptions.AttributeError'): 'dict' object has no attribute '_wrapped__object' --- ..............................Expected.............................. None -------------------------------------------------------------------------------- """
- Loading branch information