Skip to content

Commit 3ccd81d

Browse files
committed
get rid of generic name 'decorated' in decorator implementations (more informative stack trace if something crashes)
1 parent 5ca3da9 commit 3ccd81d

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

unpythonic/ec.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def s(loop, acc=0, i=0):
159159

160160
def decorator(f):
161161
@wraps(f)
162-
def decorated(*args, **kwargs):
162+
def escapepoint(*args, **kwargs):
163163
try:
164164
return f(*args, **kwargs)
165165
except Escape as e:
@@ -169,7 +169,7 @@ def decorated(*args, **kwargs):
169169
return e.value
170170
else: # meant for someone else, pass it on
171171
raise
172-
return decorated
172+
return escapepoint
173173
return decorator
174174

175175
def call_ec(f):

unpythonic/let.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,11 +276,11 @@ def deco(body):
276276
# (to preserve state between calls to the decorated function)
277277
env = _let(mode, body=None, **bindings)
278278
@wraps(body)
279-
def decorated(*args, **kwargs):
279+
def withenv(*args, **kwargs):
280280
kwargs_with_env = kwargs.copy()
281281
kwargs_with_env[_envname] = env
282282
return body(*args, **kwargs_with_env)
283-
return decorated
283+
return withenv
284284
return deco
285285

286286
def _blet(mode, _envname="env", **bindings):

unpythonic/lispylet.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,11 @@ def _dlet(bindings, mode="let", _envname="env"): # let and letrec decorator fac
255255
def deco(body):
256256
env = _let(bindings, body=None, mode=mode) # set up env, don't run yet
257257
@wraps(body)
258-
def decorated(*args, **kwargs):
258+
def withenv(*args, **kwargs):
259259
kwargs_with_env = kwargs.copy()
260260
kwargs_with_env[_envname] = env
261261
return body(*args, **kwargs_with_env)
262-
return decorated
262+
return withenv
263263
return deco
264264

265265
def _blet(bindings, mode="let", _envname="env"):

0 commit comments

Comments
 (0)