No need to traverse __wrapped__ when normal function.

This commit is contained in:
Graham Dumpleton
2013-09-01 21:34:40 +10:00
parent c62aaa1558
commit a523ca710b

View File

@@ -19,11 +19,9 @@ def synchronized(wrapped, instance, args, kwargs):
else:
# Wrapped function is a normal function or static method.
# Synchronisation is against the individual function. We
# need to traverse __wrapped__ if it exists in case we are
# dealing with a bound static method.
# Synchronisation is against the individual function.
context = getattr(wrapped, '__wrapped__', wrapped)
context = wrapped
name = '_synchronized_function_lock'
else: