[C++-sig] scope() rules?

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Thu Sep 5 00:04:28 CEST 2002


--- David Abrahams <dave at boost-consulting.com> wrote:
> > Is there a guarantee that only one module is dlopen'ed by Python at any
> given
> > time? Have threading issues be considered in the design? Or are these
> quesions
> > not relevant?
> 
> I'm pretty sure that Python only imports one module at a time. That's what
> I remember, anyway.
> 
> If that weren't the case we'd have lots more problems than just the global
> current scope().

Following your advice from a while ago I use PyImport_ImportModule() to import
a module with Python bindings for array types (flex.so) while importing other
modules that make use of these bindings (e.g. fftpack.so). I have strong
evidence that Python dlopen's the flex.so module before the initialization of
fftpack.so is finished, using print statements at the beginning and the end of
the extern "C" init functions.

from scitbx import fftpack
/net/cci/rwgk/bpl2/scitbx/fftpack/boost_python/fftpack_module.cpp(380)
/net/cci/rwgk/bpl2/scitbx/array_family/boost_python/flex_module.cpp(138)
/net/cci/rwgk/bpl2/scitbx/array_family/boost_python/flex_module.cpp(141)
/net/cci/rwgk/bpl2/scitbx/fftpack/boost_python/fftpack_module.cpp(382)

Right now, fftpack.so does not use the deprecated module object, but uses the
free def() functions. However, flex_module.cpp still uses the old module
object. My regression tests work just fine. What will happen if I convert
flex.so over to the free def() functions?

Thanks,
        Ralf


__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com




More information about the Cplusplus-sig mailing list