[Python-Dev] Re:import.c (original) (raw)
Phillip J. Eby pje at telecommunity.com
Sat May 29 16:01:59 EDT 2004
- Previous message: [Python-Dev] Re:import.c
- Next message: [Python-Dev] Stackless Python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
At 09:46 PM 5/29/04 +0200, Wiktor Sadowski wrote:
---------------------------------------------------------------------------- -------- in importfrom (ceval.c): if (x == NULL && PyErrExceptionMatches(PyExcAttributeError)) { if(!PyModuleGetState(v)) /raise the error and warn against circular import/ else /default error/ ---------------------------------------------------------------------------- -------- the same in PyGenericGetAttr (object.c): /* before raising an error*/ if(PyModuleCheck(obj) && !PyModuleGetState(obj)) /add a circular import warning to the error string/ else /default error/ ---------------------------------------------------------------------------- --------
IMO, if this approach is used, the module type should instead get a custom tp_getattro method that checks the flag, rather than scattering this logic across unrelated functions.
- Previous message: [Python-Dev] Re:import.c
- Next message: [Python-Dev] Stackless Python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]