Message14543
Logged In: YES
user_id=14198
The best I can come up with here is exposing the import lock
to the C API, with a "wait" flag.
This will allow a C function to reliably determine if an
"import" work block, or acquire the lock if not. It can
then complete its import before releasing the lock. If the
import would block, then it can take whatever action is
necessary - in the case of PyErr_Warn, it dumps the warning
to stdout.
Attaching a patch. It exposes (to the core, but not in
headers) two functions:
extern int PyImport_LockImport(int wait);
extern void PyImport_UnlockImport(void);
PyErr_Warn then uses these.
If we do go this route, it makes sense to make these
functions truly public (ie, add them to the headers), and
cleanup import.c appropriately. I didn't do this in the
interests of keeping the patch small so it can be easily
digested.
Comments? Other ideas? |
|
Date |
User |
Action |
Args |
2007-08-23 14:10:57 | admin | link | issue683658 messages |
2007-08-23 14:10:57 | admin | create | |
|