mirror of
https://github.com/boostorg/python.git
synced 2026-01-22 17:32:55 +00:00
Added module() function to get the module being built
Added initializing() function to distinguish whether a module is initializing Changed logic so that multiple non-overlapping module_builders() may be constructed. This fixes a bug when BPL is built as a shared lib. [SVN r8361]
This commit is contained in:
@@ -14,10 +14,15 @@ namespace {
|
||||
ref name_holder;
|
||||
}
|
||||
|
||||
bool module_builder::initializing()
|
||||
{
|
||||
return name_holder.get() != 0;
|
||||
}
|
||||
|
||||
string module_builder::name()
|
||||
{
|
||||
// If this fails, you haven't created a module_builder object
|
||||
assert(name_holder.get() != 0);
|
||||
assert(initializing());
|
||||
return string(name_holder);
|
||||
}
|
||||
|
||||
@@ -29,6 +34,11 @@ module_builder::module_builder(const char* name)
|
||||
name_holder = ref(PyObject_GetAttrString(m_module, const_cast<char*>("__name__")));
|
||||
}
|
||||
|
||||
module_builder::~module_builder()
|
||||
{
|
||||
name_holder.reset();
|
||||
}
|
||||
|
||||
void
|
||||
module_builder::add(detail::function* x, const char* name)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user