Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""
Helper method for signature symbols (defaults, type hints) protection.
Returns either `val`, or a protection symbol. In that case the protection symbol
is created with name `varname` and inserted into `evaldict`
:param val:
:param needs_protection:
:param varname:
:param evaldict:
:return:
"""
if needs_protection:
# store the object in the evaldict and insert name
evaldict[varname] = val
return _SymbolRef(varname)
else:
return val