implement UserCode.__call__
and fix code_history
#8929
Merged
UserCode.__call__
and fix code_history
#8929