Skip to content

Commit

Permalink
Just bail out on all AttributeErrors
Browse files Browse the repository at this point in the history
  • Loading branch information
ionelmc committed Aug 10, 2015
1 parent 0daabb8 commit 76e03b8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pytest_benchmark/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,13 @@ def clonefunc(f):
"""

# first of all, we clone the code object
if hasattr(f, '__code__'):
try:
co = f.__code__
co2 = types.CodeType(co.co_argcount, co.co_nlocals, co.co_stacksize, co.co_flags, co.co_code,
co.co_consts, co.co_names, co.co_varnames, co.co_filename, co.co_name,
co.co_firstlineno, co.co_lnotab, co.co_freevars, co.co_cellvars)
#
# then, we clone the function itself, using the new co2
return types.FunctionType(co2, f.__globals__, f.__name__, f.__defaults__, f.__closure__)
else:
except AttributeError:
return f

0 comments on commit 76e03b8

Please sign in to comment.