Alex, Michele and Skip,
Many thanks for your help, I should find my way by putting all these
information together.
Best regards,
Franck
--
http://mail.python.org/mailman/listinfo/python-list
Franck> My problem is that the errors comes from a function named
Franck> "wrapped" while I'd prefer to see here the name of the wrapped
Franck> function.
Take a look at
http://wiki.python.org/moin/PythonDecoratorLibrary
In particular, check out the Decorator decorator.
Skip
--
Using my decorator module
(http://www.phyast.pitt.edu/~micheles/python/documentation.html,
http://www.phyast.pitt.edu/~micheles/python/decorator.zip) you solve
the problem of the
name, but the traceback is still not perfect. You get:
# dec_traceback.py
from ms.decorator import decorator
@decorato
Franck Pommereau <[EMAIL PROTECTED]> wrote:
...
> import new
> def rename (fun, name) :
> return new.function(fun.func_code, {}, name)
You need to make a new code object too:
def int_result(fun) :
def wrapped(*largs, **kwargs) :
result = fun(*largs, **kwargs)
Dear all,
I would like to work around the "anonymizing" effect of decorators when
an exception is raised in the wrapped function. Let's consider the
following example:
def int_result (fun) :
def wrapped (*largs, **kwargs) :
result = fun(*largs, **kwargs)
if not