The notimplemented decorator reports now the filename and linenumber of the function.

This commit is contained in:
Bastian Kleineidam 2012-06-20 19:23:13 +02:00
parent 1e13a4f8fc
commit 727281a7fc

View file

@ -105,7 +105,9 @@ def notimplemented (func):
"""Raises a NotImplementedError if the function is called."""
def newfunc (*args, **kwargs):
"""Raise NotImplementedError"""
raise NotImplementedError("%s not implemented" % func.__name__)
co = func.func_code
attrs = (co.co_name, co.co_filename, co.co_firstlineno)
raise NotImplementedError("function %s at %s:%d is not implemented" % attrs)
return update_func_meta(newfunc, func)