On 02/22/2010 09:45 AM, André Prins wrote:
Hi All,

Recently, I had some problems with a duplicate method and class
definition begin accepted by boost::python (version 1.41 on MSVC).
Consider the following c++-code, which declares a class Foo twice, but
with different bindings for the same function.

[...]

It is obvious that this is not the intended use of Boost-python, but I
am wondering: why does it assert at runtime without the noncopyable
and why does it "more or less work" with the boost::noncopyable. And
is there a method to detect such multiple definitions of the same
class.

For the first two questions: I would suggest you consider the code "ill-formed" and the behavior "undefined", so there isn't any need to (second-)guess what the library is doing, and why things appear to be working in one case but not the other.

As to the last question: I suggest you submit a request for enhancement for this. I'm pretty sure the library can detect this, and raise an appropriate exception. Alternatively, if it is decided that the above is a valuable use-case to support, the library needs to be improved to support it.

I'm saying that because recently we had a discussion about per-module converter registries, to avoid conflicts when working with multiple extension modules that may provide equivalent converters, where it is important to be able to pick explicitly which one is going to be used.

Thanks,
        Stefan


--

      ...ich hab' noch einen Koffer in Berlin...

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

Reply via email to