troy d. straszheim wrote:

Take function new_class(...) in src/object.cpp: this is called during BOOST_PYTHON_MODULE(), and invoke.hpp doesn't know about it, therefore nothing would be locked.


Maybe this is a more practical example:


void set_foo_attr(object& obj, object& what)
{
   api::setattr(obj, "foo", what); // leave cpp in here, no unlock
}

BOOST_PYTHON_MODULE(m)
{
   def("set_foo_attr", &set_foo_attr);
}

>>> class X: pass
>>> x = X()
>>> set_foo_attr(x, ['something'])
>>> print x.foo
['something']


Here, enter/exitCPP would be called by invoke.hpp when set_foo_attr fires, but not when api::setattr calls PyObject_SetAttrString.

-t
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to