Metaclasses, decorators, and synchronization
Michael Ekstrand
mekstran at scl.ameslab.gov
Mon Sep 26 17:58:16 EDT 2005
On Sep 26, 2005, at 4:21 PM, Scott David Daniels wrote:
> Unnecessarily holding a lock while acquiring another can be a nasty
> source of deadlock or at least delay. Another source of problems is
> holding a lock because an exception skipped past the release code.
I had thought of part of that after I sent my email. Didn't think of
the exception issue or the specific deadlock scenario though. Thank
you much for your help/advice.
One issue remains in this function: my method's signature is lost when
synchronized is applied (at least as somemeth=synchronized(somemeth);
I'm currently in a 2.3 environment that doesn't have the decorator
syntax, but my understanding is that makes no difference). I've been
able to preserve the doc string by setting the __doc__ attribute of the
inner function before returning it, but is there a way to make this
inner function appear to bear the same argument list as the original
method? I've been poking around in new and inspect, but it is not
appearing like an easy task.
Thanks,
- Michael
More information about the Python-list
mailing list