On 29.01.2016 19:19, David Sankel wrote: > Hello all, > > I'd like to allow a class to be registered more than once and wanted > to get your opinion if this change would be a good idea. > > 'boost::python::class_' always adds a class to the current scope and > registers it in the global registry. The global registry code > (particularly the 'insert' function in 'src/converter/registry.cpp') > asserts that the class hasn't been registered already. This, of > course, prevents multiple registrations of the same type. > > There is a use case, though, where multiple registrations of the same > type is both necessary and safe. Generally, a c++ component which has > a 'class_' call may not know the name of the module it will eventually > end up in. It would still be desirable to write a unit test for this > component. If we write a unit test and put the 'class_' into some > dummy module we run into a problem where other unit tests might call > 'class_' in another scope. > > The safety of multiple 'class_' calls stems from always using the same > conversion function. Semantically everything is a-okay. > > I'm proposing to change the precondition of the > 'boost::python::converter::registry::insert' function from: > > The behavior is undefined unless the specified 'type_info' object > has not already been registered. > > > to: > > The behavior is undefined unless the specified 'type_info' object > has not already been registered with a semantically different > converter > > Any objections?
Yes. Can you describe your use-case ? And what do you mean exactly by "semantically different" ? :-) Thanks, Stefan -- ...ich hab' noch einen Koffer in Berlin... _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org https://mail.python.org/mailman/listinfo/cplusplus-sig